Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

spaceship.lua implemented

File size: 699 bytes
RevLine 
[4051]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
[4056]15randTime = 8 * math.random()
[3927]16end
17end
18
19
20function fallDown(timestep)
[4066]21dy = dy + timestep
[3966]22thisX = fallingguy:getAbsCoorX()
23thisY = fallingguy:getAbsCoorY()
24thisZ = fallingguy:getAbsCoorZ()
[3927]25
[3966]26fallingguy:setAbsCoor(thisX, thisY - dy, thisZ)
27
[4056]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.