Rev | Line | |
---|
[3927] | 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 = 5 * 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 | io.write("Falldown called \n") |
---|
| 24 | RandTime() |
---|
| 25 | |
---|
| 26 | if randTime > 0 then |
---|
| 27 | randTime = randTime - timestep |
---|
| 28 | else |
---|
| 29 | fallDown(timestep) |
---|
| 30 | end |
---|
| 31 | |
---|
| 32 | return eventFinished |
---|
| 33 | |
---|
| 34 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.