Hello all,
I'm using a sprite sheet to hold my main players graphics. The last frame is the sprite for when the player is falling / in air. My code checks the direction of the player and flips the bitmap accordingly. However when flipping the frame for falling, the x location where the player is drawn gets flipped as well. Example, the frame on the sprite sheet starts at x = 102, and y = 0. When facing right (unflipped) the sprite draws at the correct location (the players x location). When facing left (the sprite is flipped) the sprite draws at the x location + 102. I feel like I have had this problem before and can't remember how it was fixed. I know I can just make a separate frame, and I will if I need to, but I'm curious what could be causing this. Anyone have any suggestions? My code is below:
Also, I tried removing the parts in the draw function where x_adjust is set, changing it so x_adjust is always = 0, and this didn't change anything. Any suggestions or ideas would be welcome.
]]>I assume something is wrong with the x coordinate of player? Perhaps debgugging o a few printfs could clarify this.
]]>I didn't look very closely at it, but it seems to me that line 33 should be:
x_adjust = P_STAND_W - al_get_bitmap_width(curFrame)/2;
]]>
Shouldn't they both be divided by 2? To center the player?
]]>