Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/single_player_map/scripts/falldown.lua @ 3966

Last change on this file since 3966 was 3966, checked in by snellen, 18 years ago

implemented fallingguy

File size: 580 bytes
Line 
1dy = 0
2randTime = 0
3eventFinished = false
4randinit = false
5
6function RandTime()
7
8if not randinit then
9math.randomseed(os.clock())
10randinit = true
11randTime = 10 * math.random()
12end
13end
14
15
16function fallDown(timestep)
17dy = dy + timestep*0.01
18thisX = fallingguy:getAbsCoorX()
19thisY = fallingguy:getAbsCoorY()
20thisZ = fallingguy:getAbsCoorZ()
21
22fallingguy:setAbsCoor(thisX, thisY - dy, thisZ)
23
24if thisY < 0 then
25eventFinished = true
26end
27
28end
29
30
31function tick(timestep)
32
33RandTime()
34
35if randTime > 0 then
36randTime = randTime - timestep
37else
38fallDown(timestep)
39end
40
41return eventFinished
42
43end
Note: See TracBrowser for help on using the repository browser.