My 2D top-down shooter game wants some syntactic sugar to rotate the bitmap and the whole bitmap around another bitmap or point (which is the player). Please help me out
Thanks in advance
Do yourself a favor and draw out what you want to do on paper and look at the math. Then it should be clear how to proceed programming your app.
rotate_bitmap_around_another_bitmap();
Cookies please.
Hey Dizzy, looks like your shell is still intact. Glad to hear it. 
Drop some sick beats
Edgar Reynaldo and Dizzy Egg - than you for the replay.
I will try to sort out a way to do that using trigonometry or simple geometric mathematics.
It's the sum of two angles and a point rotated around the circle.
Take the rotation of the world, add in the rotation of the object in the world with it, then draw it on your rotated world.
Edgar Reynaldo and Neil Roy- thank you for replying
I fixed it using the transform
al_identity_transform(&transform); al_translate_transform(&transform, -playerX, -playerY); al_rotate_transform(&transform, cameraRotation * 3.14 / 180); al_translate_transform(&transform, playerX, playerY); al_use_transform(&transform);
when drawing the player i used rotation (360 - cameraRotation), so that the player won't rotate, rather the world will rotate around the player.
Thinkal_VB, glad you solved it. See, you could do it!
Thank you Edgar Reynaldo, for your compliments and help.
You should probably use a few more decimal places with your 3.14 constant there or after you spin the camera a few times it will start being off...
You should probably use a few more decimal places with your 3.14 constant there or after you spin the camera a few times it will start being off...
He should use ALLEGRO_PI.
Thank you Elias and Eric Johnson,
I used #define PI 3.14159f in my actual code.
That code was purely representational(in the post). However, thank you for letting me know about the ALLEGRO_PI. I will change my code to use ALLEGRO_PI as it is more precise.