Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

spaceship.lua implemented

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