Drawing bitmap on the display rather than on the map
I recently started to use the allegro5 library and am trying to make a local multiplayer game but i have the following problem : When I draw my character sprites I use the al_draw_bitmap_region() function, but it seems to always draw my character in positions relating to my screen. Therefore, when I try to draw the second character it cannot stay on the map outside my window( the map is way larger than the screen i created ).
Any help would be appreciated!
What you're looking for is al_set_target_bitmap. The coordinates are on the target bitmap, so whatever you set it to be, that is where they will be drawn.
Reset the drawing target to the backbuffer when you're done.
OR maybe I misunderstood what you want.
If you're drawing to the map, you need map coordinates, if you're drawing to the screen, you need screen coordinates.
To relate the two together, take the position on your map, and subtract it from your player's map coordinates. This will give you the screen coordinates of your player (whether they are on screen or not).
Thank you very much, I got it working properly now!
Thread #617868. Printed from Allegro.cc
Congrats! If you need any more help, that's what we're here for.