Skip to main content
gamedev.net
🔒 Locked

VB 6 Timer Question

Started by malo 1 reply 950+ views
Original Post
malo
malo
Im having problems making the loop wait till the timer interval finishes and then continues to run. What i want is for a timer be in the loop and when the timer turns on the loop waits until the timer has finished and then continues. Ive tried all sorts of ways but the timer keeps getting ignored. Case vbKeyUp If character.Top = area(20).Top And character.Left = area(20).Left Then Exit Sub Else north = 0 Do While north <> 360 '-----Need timer here ----- character.Top = character.Top - 60 north = north + 60 Loop End If Thanks in advance ><
jake_Ghost
jake_Ghost
what i would do is just put all that in a timer. When it fires, it will move whatever your trying to move if the the collision is false. Also try not to use to many timers because it gets somewhat confusing managing them and a pain in the ass when debugging :p

hope this helps
Jake
remmargorp
remmargorp
you put a pause loop... probably not very efficient

timer.value=True 'start the timer

do
DoEvents() 'let the machine process other things
while timer.value=True 'wait for the timer to stop


at the end of whatever is to be processed in the timer you put

timer.value=False 'stop the timer from looping/restarting

I haven't used VB in forever, so don't mind me if I'm completely wrong

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.