Re: Image Not Appearing
- Posted by Lone_EverGreen_Ranger Dec 21, 2011
- 1890 views
Success. I was missing SDL_Flip(), which is why it was not showing up on the screen. However not I am having a problem with keeping the ship stay on the screen.
I think you meant to say
However, now I am having a problem with keeping the ship stay on the screen.
I ran the code and see the problem. The ship goes down ... and then down ... and never comes back up, unless I hit the arrow keys to move it up.
I think your intent was to have it bounce all around the screen, but when it hit an edge then it'd go the opposite direction.
Your if statement is wrong, but I don't think a single if statement is enough to handle this behavior. You need a more complex state machine to keep track of direction and how close the ship is to the edges of the screen.
I see. I figured it would involve more complex steps. If anyone could give me a headstart, I'd greatly appericate it. I'm not tasking to write my game, just some help.