View Single Post
Old 09-29-2007, 12:00 PM   #11
MRichards
FFR Player
 
MRichards's Avatar
 
Join Date: May 2006
Posts: 91
Default Re: Programmers out there o/

Don't use a loop to move the arrow: while the loop is going round, the key press code won't be called. So your program isn't working because it only accepts key presses before the arrow moves and after it has gone off the top of the screen

In all games you need an Update procedure that is called periodically. In this procedure, you move the game objects by a single small step. This will make the objects move over time, but also allow other code (like key press code) to have a chance to run.

Here's a VB project that does just that. It uses a timer to call an update procedure, called the timer tick. Otherwise it works like your program (press 'A' key for up):
http://www.latent.demon.co.uk/downloads/VB-FFR1.zip

To have multiple arrows, you will need to use an array. Here's an extension of the above program showing the idea, plus a few other niceties:
http://www.latent.demon.co.uk/downloads/VB-FFR2.zip
If you can't understand this program then you need to try something simpler.

BTW: The programs were built in Visual Studio 2005, if you can't load them, then you'll just have to look at the .vb file to get the idea.
__________________

Last edited by MRichards; 09-29-2007 at 12:04 PM..
MRichards is offline   Reply With Quote