Computer Science Canada Some newbie help here please |
Author: | RaLz [ Wed May 12, 2004 4:16 pm ] |
Post subject: | Some newbie help here please |
Hey im trying to make a game in vb and it's basically my first time trying to make on in vb. So i need some info. Right now im trying to make my character run across the screen but i have a problem if i hold down the arrow key and say i put a loop like this " Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 37 Then Do Until KeyUp = 37 char.Left = char.Left - 10 loop end if the character just zooms across the screen and crashes vb. Now i was wondering if there is some delay command like in turing to slow this process down. If you guys have any suggestions on how to make this run smoothly it would be much appreaciated. |
Author: | Tony [ Wed May 12, 2004 4:24 pm ] | ||||
Post subject: | |||||
well instead of -10, you could move by a smaller incroment... such as -0.1 or you could use a system delay which in VB is called sleep
and is called
where numMilliseconds is an integer value of the delay in milliseconds |
Author: | RaLz [ Wed May 12, 2004 4:51 pm ] |
Post subject: | |
Thanks!! |
Author: | RaLz [ Wed May 12, 2004 5:05 pm ] | ||
Post subject: | |||
umm here is my code for the moment how do i get the keyup function to work and by the way the sleep function works great.
I want to put do until keyup = 37 but it's not working because it sees keyup as just a variable. |
Author: | RaLz [ Wed May 12, 2004 5:31 pm ] |
Post subject: | |
Never mind i figured it out ![]() |