Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/single_player_map/scripts/guard.lua @ 3950

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

continued implementation…

File size: 1.3 KB
Line 
1-- Global Variables
2walkingRouteOne = true   -- True if thestranger is walking route one
3exitPositionReached = false
4playerInLock = false
5hangarReached = false
6
7-- Returns the distance between (x1,x2,x3) and (y1,y2,y3)
8function dist( x1,x2,x3, y1,y2,y3 )
9
10return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 )
11
12end
13
14function stopWalkRouteOne(timestep)
15walkRouteOne = false
16return true
17end
18
19function observePlayer()
20playerX = Player:getAbsCoorX()
21playerY = Player:getAbsCoorY()
22playerZ = Player:getAbsCoorZ()
23
24if dist( playerX,playerY,playerZ,161.76,49,358.87 ) < 60 then
25playerInLock = true
26end
27
28end
29
30routeOneProgrammed = false
31function walkRouteOne(timestep)
32
33if not routeOneProgrammed then
34io.write("Guard called \n")
35guard:walkTo(-154.592667, 80.000000, 231.381805)
36routeOneProgrammed = true
37end
38
39end
40
41function goToExitPosition(timestep)
42
43return false
44end
45
46
47function goToHangar(timestep)
48
49return false
50end
51
52
53function waveToSpaceship(timestep)
54
55end
56
57
58function tick(timestep)
59--io.write("Guard called \n")
60observePlayer()
61
62if walkingRouteOne then
63walkRouteOne(timestep)
64end
65
66if not walkingRouteOne and not exitPositionReached then
67exitPositionReached = goToExitPosition(timestep)
68end
69
70if playerInLock and exitPositionReached then
71hangarReached = goToHangar(timestep)
72end
73
74if hangarReached then
75waveToSpaceship(timestep)
76end
77
78return false
79end
80 
Note: See TracBrowser for help on using the repository browser.