Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/single_player_map/scripts/prisoner.lua @ 3947

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

continued implementation…

File size: 1.3 KB
RevLine 
[3946]1cellDoorOpened = false
2walkinCellFinished = false
3cellExitReached = false
[3945]4exitReached = false
5hangarReached = false
6spaceShipReached = false
7spaceShipEntered = false
8
[3946]9randTime = 0
[3945]10
11function setCellDoor(timestep)
12cellDoorOpened = true
13return true
14end
15
16
17function walkInCell(timestep)
18
[3946]19if cellDoorOpened then
20
21if randTime == 0 then
22randTime = 30 * math.random()
23else
24randTime = randTime - timestep
[3945]25end
26
[3946]27if randTime < 0 then
28-- goto cellexit
29-- if exit reached: return true
30end 
[3945]31
[3946]32end
[3945]33
[3946]34
35return false
36
37end
38
39
40
[3945]41function goToExit(timestep)
[3946]42-- do not forget to make him wait until the player triggeres the trip to the hangar
[3945]43
44return false
45end
46
47
48function goToHangar(timestep)
49
50
51return false
52
53end
54
55
56function goToSpaceship(timestep)
57
58return false
59
60end
61
62
63function enterSpaceship(timestep)
64
65return false
66end
67
68
69
70function tick(timestep)
71
[3946]72--io.write("Prisoner called \n")
73
[3945]74if not cellDoorOpend then
[3946]75walkinCellFinished = walkInCell(timestep)
[3945]76end
77
[3946]78if walkinCellFinished and not exitReached then
[3945]79exitReached = goToExit(timestep)
80end
81
82if exitReached and not hangarReached then
83hangarReached = goToHangar(timestep)
84end
85
86if hangarReached and not spaceShipReached then 
87spaceShipReached = goToSpaceship(timestep)
88end
89
90if spaceShipReached and not spaceShipEntered then
91spaceShipEntered = enterSpaceship(timestep)
92end
93
94if spaceShipEntered then
95return true
96end
97
98return false
99end
Note: See TracBrowser for help on using the repository browser.