Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/old.trunk/scripts/falldown.lua @ 4663

Last change on this file since 4663 was 4080, checked in by bensch, 18 years ago

orxonox/data/trunk: merged the single_player_map back.
merged with command:
svn merge https://svn.orxonox.net/data/branches/single_player_map . -r624:HEAD
no conflicts, that mattered (all merged to the favour of the branche)

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.