Computer Science Canada Timer won't work for some reason |
Author: | SeeknDestroy [ Sun Jan 11, 2004 11:49 am ] | ||
Post subject: | Timer won't work for some reason | ||
well, here's my code for a level of my shooter, and when i run it, the people dont stay, they just flash for a half a second then disappear, but i put a timer on them , well, here's my code, i don't want u guys to write me a code, just tell me whats wrong and how can i fix it, plz, im so new to turing, and well, plz help me
|
Author: | SeeknDestroy [ Sun Jan 11, 2004 12:58 pm ] |
Post subject: | |
plz, help me out, i mean there were 10 views and no replies. |
Author: | Andy [ Sun Jan 11, 2004 2:28 pm ] |
Post subject: | |
ok get winzip, and zip the code with the pictures so we can help and comment the part u think is wrong |
Author: | SeeknDestroy [ Sun Jan 11, 2004 3:06 pm ] |
Post subject: | |
ok, thnx a bunch, well here is my code wit pictures. thnx a lot for the help, i really appreiciate it |
Author: | PaddyLong [ Sun Jan 11, 2004 3:21 pm ] |
Post subject: | |
when I run it they stay until I click on them |
Author: | SeeknDestroy [ Sun Jan 11, 2004 3:28 pm ] |
Post subject: | |
yea, thats the problem, i tried to put a timer on them, but the timer doesn't seem to work and so i commented the timer, do u know a way around it? plz tell me. thnx |
Author: | poly [ Sun Jan 11, 2004 3:38 pm ] |
Post subject: | |
Okay I see what you want. You want it so the enemy will only appear for a certain amount of time (which you ahve chosen 1000). Im gonna take a stab at saying(cause me dont have turing installed right now) the main problem is that the counter is in the procedure. AN easy way to do what you want is down where you have the actual game code you could do something like: displayEnemy1 and counter starts if the enemy1 has been clicked than clear him off screen if not keep him on or clear him off when counter reaches limit displayEnemy2 and counter starts if the enemy2 has been clicked than clear him off screen if not keep him on or clear him off when counter reaches limit displayEnemy3 and counter starts if the enemy3 has been clicked than clear him off screen if not keep him on or clear him off when counter reaches limit ... and well you cant get crappier pseudo-coding than that ladies and gents! |
Author: | SeeknDestroy [ Sun Jan 11, 2004 3:42 pm ] |
Post subject: | |
ok, kool, thnx for the help, ill see if i can code that |
Author: | poly [ Sun Jan 11, 2004 3:48 pm ] |
Post subject: | |
hmm you understood what i meant? Wow, after reading it I dont know what the hell i was talking about, im not much of an explaining kind of person |
Author: | SeeknDestroy [ Sun Jan 11, 2004 3:51 pm ] |
Post subject: | |
yea, i think u mean to put the timer thing at the bottom where i have the randint thing rite? but acutally, i've changed my code again, so now there is a pattern to the enemies appearing. and yea, after looking at the code again, i couldn't figure it out, |
Author: | poly [ Sun Jan 11, 2004 3:52 pm ] |
Post subject: | |
oh so now your stuck again? What part of the code did you change? |
Author: | SeeknDestroy [ Sun Jan 11, 2004 3:57 pm ] | ||
Post subject: | |||
well, now my procedures arn't called through the randint thing. i created a loop and called the procedures in the loop. so i dont need the counter n e more. however, i tried to use the clock(timer) thing as a timer and in my procedures, but when i run it, the people either stay there, or they all flash for a millisecond and goes away
|
Author: | SeeknDestroy [ Sun Jan 11, 2004 6:17 pm ] | ||
Post subject: | |||
well, i figured out a lot of the code thnx to all ur help. but now i can't get the timer to work. i declared a variable in every procedure where the enemies appear, and put in an exit when timer >= 1500 . and it just flashes reallly fast, and i know for a fact that its not the time 1500 cuz the first guy stays for that long, then the rest just flashes by. and here's my code
|
Author: | Dan [ Sun Jan 11, 2004 11:55 pm ] | ||
Post subject: | |||
well one thing was that var timer:= 0 was in the loop, that was probly a bad thing. the other is that i dont think the clock fucttion is wroking the way you whont it to. i whould use the Time.Sec fuction b/c it is in Secondes not millseconeds and it wroked for this proagme when i tested it. should look stoming like this:
Time.Sec returns how many secnonds since 1970. so what you have to do is take the reading of it b4 the loop then subtrated Time.Sec from it to get how many seconds have pasted. NOTES: 1. it is now in seconds not millsceonds, so you will whont a value like 1-3 not 1500 2. i did not have the code for some of your fuctions so i left them out of my sample code there |
Author: | SeeknDestroy [ Mon Jan 12, 2004 4:20 pm ] |
Post subject: | |
o man, thanks soo much, i really appreciate it, this timer is awesome! thnx! |