Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/scripts/falldown.lua @ 4090

Last change on this file since 4090 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
RevLine 
[4080]1-- Get objects from orxonox
2thisscript:addObject("TestEntity", "fallingguy")
3thisscript:addObject("FPSPlayer", "Player")
4
[3966]5dy = 0
[3927]6randTime = 0
7eventFinished = false
8randinit = false
9
10function RandTime()
11
12if not randinit then
13math.randomseed(os.clock())
14randinit = true
[4080]15randTime = 8 * math.random()
[3927]16end
17end
18
19
20function fallDown(timestep)
[4080]21dy = dy + timestep
[3966]22thisX = fallingguy:getAbsCoorX()
23thisY = fallingguy:getAbsCoorY()
24thisZ = fallingguy:getAbsCoorZ()
[3927]25
[3966]26fallingguy:setAbsCoor(thisX, thisY - dy, thisZ)
27
[4080]28if thisY < -100 then
[3927]29eventFinished = true
30end
31
[3966]32end
[3927]33
[3966]34
[3927]35function tick(timestep)
[3945]36
[3927]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.