|
-
Jan 15th, 2005, 01:45 AM
#1
Thread Starter
New Member
timer?
i have multiple timers, is there anyway to stop them all at once?, sorry if i sound dumb, i just started VB for school, and we have to make a program for finals.
Last edited by fallingjazz; Jan 15th, 2005 at 01:49 AM.
-
Jan 15th, 2005, 02:00 AM
#2
Re: timer?
there are very few times that you actually need to use more than one timer in a project. desribe what you need to do and someone will help you do it without multiple timers.
-
Jan 15th, 2005, 02:01 AM
#3
Thread Starter
New Member
Re: timer?
 Originally Posted by dglienna
there are very few times that you actually need to use more than one timer in a project. desribe what you need to do and someone will help you do it without multiple timers.
im trying to make a pong game.
-
Jan 15th, 2005, 02:06 AM
#4
Re: timer?
why would you need more than one timer? It could count off minutes, and you could do other things based on the time elapsed.
-
Jan 15th, 2005, 02:08 AM
#5
Thread Starter
New Member
Re: timer?
one timer to hit the padel, one timer to go in the other direction, one timer to send it back. Thats how my teacher told me to do it, so i dont know how else i would go about it.
-
Jan 15th, 2005, 02:09 AM
#6
Re: timer?
i agree one timer is enough, but here is the code to turn them all off
VB Code:
For Each control In Controls
If TypeOf control Is timer Then control.Enabled = False
Next
regds pete
-
Jan 15th, 2005, 02:10 AM
#7
Re: timer?
if timer1.timer <= 0 then
timer1.enabled =false
timer2.enabled =false
timer3.enabled =false
timer4.enabled =false
i think thats the best way for a beginner
Last edited by |2eM!x; Jan 15th, 2005 at 02:15 AM.
-
Jan 15th, 2005, 02:14 AM
#8
Re: timer?
except that you have it backwards. that is less than zero, and the timer will always be > zero (greater)
-
Jan 15th, 2005, 02:17 AM
#9
Re: timer?
well i typed it wrong but it should have a textbox
and the textbox should be minusing so
text1.text = text1.text - 1
if text1.text <=0 then
timer1.enabled =false
timer2.enabled =false
timer3.enabled =false
timer4.enabled =false
if you dont have the <= to zero, sometimes the timer will skip to -1, and then it will continue to run, so i like the <=
-
Jan 15th, 2005, 02:17 AM
#10
Thread Starter
New Member
Re: timer?
how would you make pong w/o timers?
-
Jan 15th, 2005, 02:20 AM
#11
Re: timer?
if the ball goes past the left side of the form, then it is out. if the paddle connects at the edge of the form, it goes back. if it goes back and forth 5 times, it speeds up. you could even have it play itself. just move the paddles randomly, and if they connect, great.
-
Jan 15th, 2005, 02:30 AM
#12
Re: timer?
if timer1.timer <= 0 then
timer1.enabled =false
timer2.enabled =false
timer3.enabled =false
timer4.enabled =false
i think thats the best way for a beginner
so how did you know how many timers there were to turn off? no one told me it was 4, if there is more than 4 some won't be turned off, and if less than 4 an error will be generated
p.
-
Jan 15th, 2005, 02:43 AM
#13
Re: timer?
i read "multiple" as 4 for some reason..damn brain
-
Jan 15th, 2005, 03:08 AM
#14
Re: timer?
I don't remember pong as having a timer. you played until you lost. there was no beating the box.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|