Last change
on this file since 3951 was
3945,
checked in by snellen, 18 years ago
|
wrote prototype for prisoner, guard, secondguard
|
File size:
410 bytes
|
Line | |
---|
1 | |
---|
2 | randTime = 0 |
---|
3 | eventFinished = false |
---|
4 | randinit = false |
---|
5 | |
---|
6 | function RandTime() |
---|
7 | |
---|
8 | if not randinit then |
---|
9 | math.randomseed(os.clock()) |
---|
10 | randinit = true |
---|
11 | randTime = 10 * math.random() |
---|
12 | end |
---|
13 | end |
---|
14 | |
---|
15 | |
---|
16 | function fallDown(timestep) |
---|
17 | |
---|
18 | eventFinished = true |
---|
19 | end |
---|
20 | |
---|
21 | |
---|
22 | function tick(timestep) |
---|
23 | |
---|
24 | RandTime() |
---|
25 | |
---|
26 | if randTime > 0 then |
---|
27 | randTime = randTime - timestep |
---|
28 | else |
---|
29 | io.write("Falldown called \n") |
---|
30 | fallDown(timestep) |
---|
31 | end |
---|
32 | |
---|
33 | return eventFinished |
---|
34 | |
---|
35 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.