|
|
| How do I center a sprite and move it relative to the map and other objects? |
|
EatDaPewPew
Member #16,739
September 2017
|
I am making a space game with heavy use of bitmaps and primitives. I am having difficulty figuring out how I would center the user controlled spaceship and move it relative to asteroids, lasers and (*eventually if I could make multiplayer*) other spaceships that are centered and can scroll. |
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
To center an image, draw it at x = (screen_width - bitmap_width)/2 , y = (screen_height - bitmap_height)/2 . Or to center the screen on a ship, set its coordinates to ship_x - (screen_width - ship_width)/2 , ship_y - (screen_height - ship_height)/2 . 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 |
|
EatDaPewPew
Member #16,739
September 2017
|
Wow, I feel stupid for not using al_hold_bitmap_drawing(), it makes drawing the tile map a lot smoother and no artifacts when I draw ship, lasers and asteroids! |
|
|