Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/scripts/cutscene/cutscene.lua @ 4939

Last change on this file since 4939 was 4765, checked in by snellen, 18 years ago

adapted all the scripts to the new trunk

File size: 5.2 KB
Line 
1-- Main trigger
2trigger = TickTrigger()                     -- Create the trigger
3trigger:setScript("cutscene.lua")             -- Tell the trigger which script to call
4trigger:setFunction("tick")                   -- Tell the trigger which scriptfunction to call
5 
6
7
8-- Cameraswitchzero
9triggerZero = SpaceTrigger()
10triggerZero:setScript("cutscene.lua")
11triggerZero:setFunction("switchCamToBomber")
12triggerZero:setAbsCoor(37 , 0 , -200)
13triggerZero:setTarget("CameraOne")
14triggerZero:setRadius(10)
15--triggerZero:setDebugDraw(true)
16
17
18-- Cameraswitchone
19triggerOne = SpaceTrigger()
20triggerOne:setScript("cutscene.lua")
21triggerOne:setFunction("switchCamTargetToEarth")
22triggerOne:setAbsCoor(5 , 0 , -140)
23triggerOne:setTarget("CameraOne")
24triggerOne:setRadius(10)
25--triggerOne:setDebugDraw(true)
26
27
28-- Cameraswitchtwo
29triggerTwo = SpaceTrigger()
30triggerTwo:setScript("cutscene.lua")
31triggerTwo:setFunction("switchCamToSpaceship")
32triggerTwo:setAbsCoor(0, 0 , -25)
33triggerTwo:setTarget("CameraOne")
34triggerTwo:setRadius(5)
35--triggerTwo:setDebugDraw(true) 
36
37-- Cameraswitchthree
38triggerThree = SpaceTrigger()
39triggerThree:setScript("cutscene.lua")
40triggerThree:setFunction("switchCamToStation")
41triggerThree:setAbsCoor(-125, 0 , -25)
42triggerThree:setTarget("CameraOne")
43triggerThree:setRadius(5)
44--triggerThree:setDebugDraw(true) 
45
46
47-- startScenery
48triggerFour = SpaceTrigger()
49triggerFour:setScript("cutscene.lua")
50triggerFour:setFunction("startSceneryOne")
51triggerFour:setAbsCoor(125,0,-245)
52triggerFour:setTarget("CameraOne")
53triggerFour:setRadius(5)
54--triggerFour:setDebugDraw(true) 
55
56-- Scroller
57triggerScr = TimeTrigger()                 
58triggerScr:setScript("cutscene.lua")             
59triggerScr:setFunction("startScrolling")
60triggerScr:setDelay(10)
61
62
63-- Get objects from orxonox
64thisscript:addObject("CameraMan", "cameraManager")
65thisscript:addObject("NPC", "shutleOne")
66thisscript:addObject("NPC", "bomberOne")
67thisscript:addObject("NPC", "fighterOne")
68thisscript:addObject("NPC", "bomberTwo")
69thisscript:addObject("NPC", "fighterTwo")
70thisscript:addObject("NPC", "pirateOne")
71thisscript:addObject("NPC", "pirateTwo")
72thisscript:addObject("NPC", "fighterThree")
73thisscript:addObject("NPC", "bomberThree")
74thisscript:addObject("NPC", "bomberFour")
75thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld")
76thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen")
77
78
79-- Global Variables
80time = 0
81fadeout = false
82bInit = 0
83bInit2 = 0
84sceneryOneStopped = false
85sceneryOneRunning = false
86stationReached = false
87
88-- Switch cam functions
89function switchCamTargetToEarth(timestep)
90cameraManager:changeCurrTarget("Planet", "Earth")
91return true
92end
93
94function switchCamToSpaceship(timestep)
95cameraManager:attachCurrCamera( "NPC", "shutleOne")
96return true
97end
98
99function switchCamToStation(timestep)
100cameraManager:attachCurrCamera("Building", "zhara")
101stationReached = true
102time = 0
103--cameraManager:detachCurrCamera()
104return true
105end
106
107function switchCamToBomber(timestep)
108cameraManager:changeCurrTarget( "NPC", "fighterTwo")
109return true
110end
111
112-- Start
113function startSceneryOne(timestep)
114
115--shutleOne:unhide()
116--bomberOne:unhide()
117--fighterOne:unhide()
118--bomberTwo:unhide()
119--fighterTwo:unhide()
120--pirateOne:unhide())
121--pirateTwo:unhide()
122--fighterThree:unhide()
123--bomberThree:unhide()
124
125shutleOne:pause(false)
126bomberOne:pause(false)
127fighterOne:pause(false)
128bomberTwo:pause(false)
129fighterTwo:pause(false)
130pirateOne:pause(false)
131pirateTwo:pause(false)
132fighterThree:pause(false)
133bomberThree:pause(false)
134bomberFour:pause(false)
135
136sceneryOneRunning = true
137time = 0
138
139return true
140
141end
142
143-- Stop
144function stopSceneryOne(timestep)
145
146--shutleOne:hide()
147--bomberOne:hide()
148--fighterOne:hide()
149--bomberTwo:hide()
150--fighterTwo:hide()
151--pirateOne:hide())
152--pirateTwo:hide()
153--fighterThree:hide()
154--bomberThree:hide()
155
156shutleOne:pause(true)
157bomberOne:pause(true)
158fighterOne:pause(true)
159bomberTwo:pause(true)
160fighterTwo:pause(true)
161pirateOne:pause(true)
162pirateTwo:pause(true)
163fighterThree:pause(true)
164bomberThree:pause(true)
165bomberFour:pause(true)
166
167return true
168
169end
170
171-- Start the scrolling screen
172function startScrolling(timestep)
173scrollingScreen:start()
174return true
175end
176
177-- THE tick function
178
179function tick(timestep)
180time = time + timestep
181triggerScr:start()
182
183if not sceneryOneStopped then
184sceneryOneStopped = stopSceneryOne(timestep)
185end
186
187if bInit == 0 then
188  cameraManager:initFadeBlack()
189  gameWorld:showText("Earth Solar System");
190  bInit = 1
191end
192
193if time > 2 and bInit2 == 0 then
194   cameraManager:toggleFade()
195   bInit2 = 1
196end
197
198
199
200if time > 8 and time < 8.5 and sceneryOneRunning then
201   fighterThree:fire()
202end
203
204if not cameraSwitched then
205cameraManager:setCam("CameraOne")
206cameraManager:jumpCurrCam(125,0,-245)
207--cameraManager:attachCurrCamera("NPC", "transporterOne")
208cameraManager:changeCurrTarget("Building", "zhara")
209cameraSwitched = true
210end
211
212if time > 4  and stationReached and not fadeout then
213cameraManager:toggleFade()
214fadeout = true
215end
216
217if time > 6 and stationReached then
218gameWorld:setNextStoryName( "Space Station 1" ) 
219gameWorld:stop()
220return true
221end
222
223return false
224end 
Note: See TracBrowser for help on using the repository browser.