how to move a image

Started by
9 comments, last by Captain P 15 years, 9 months ago
You have a main loop, in which you check for input. You move the player sprite based on this input and then you draw it. These steps are repeated over and over again, until the program is closed.

Now, you added bullet firing code. You probably wrote a for loop that moves the bullets until they're outside the screen, right? Then tell me - why do you expect the player to react to input as long as that loop is running? There's no input checks being done inside that loop. There's no player updating going on in that loop. There's only bullet updating. Basically, that loop blocks the rest of your program.


Which is why I suggest only creating bullets when firing - and updating them inside the main loop. Hey, why don't you post your code so we can make some proper suggestions? (Tip: use the [source] or [code] tags to preserve formatting).
Create-ivity - a game development blog Mouseover for more information.

This topic is closed to new replies.

Advertisement