|
Rotating bitmap in local and global axis ? |
Thinkal VB
Member #16,859
May 2018
|
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 |
Edgar Reynaldo
Major Reynaldo
May 2007
|
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. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dizzy Egg
Member #10,824
March 2009
|
rotate_bitmap_around_another_bitmap(); Cookies please.
---------------------------------------------------- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Hey Dizzy, looks like your shell is still intact. Glad to hear it. Drop some sick beats My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Thinkal VB
Member #16,859
May 2018
|
Edgar Reynaldo and Dizzy Egg - than you for the replay. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
It's the sum of two angles and a point rotated around the circle. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
|
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. --- |
Thinkal VB
Member #16,859
May 2018
|
Edgar Reynaldo and Neil Roy- thank you for replying 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. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Thinkal_VB, glad you solved it. See, you could do it! My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Thinkal VB
Member #16,859
May 2018
|
Thank you Edgar Reynaldo, for your compliments and help. |
Elias
Member #358
May 2000
|
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... -- |
Eric Johnson
Member #14,841
January 2013
|
Elias said: 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.
|
Thinkal VB
Member #16,859
May 2018
|
Thank you Elias and Eric Johnson, |
|