Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4621 was 4606, checked in by patrick, 18 years ago

scripts and txt

File size: 3.2 KB
Line 
1-- Main trigger
2trigger = ScriptTrigger()                     -- Create the trigger
3trigger:setScript("cutscene.lua")             -- Tell the trigger which script to call
4trigger:setFunction("tick")                   -- Tell the trigger which scriptfunction to call
5trigger:setActiveOnCreation(true)     
6
7
8-- Cameraswitchzero
9triggerZero = ScriptTrigger()
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 = ScriptTrigger()
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 = ScriptTrigger()
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 = ScriptTrigger()
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-- Get objects from orxonox
48thisscript:addObject("CameraMan", "cameraManager")
49thisscript:addObject("NPC", "fighterThree")
50thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld")
51thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen")
52
53
54-- Global Variables
55time = 0
56stationReached = false
57fadeout = false
58bInit = 0
59bInit2 = 0
60
61
62-- Switch cam functions
63function switchCamTargetToEarth(timestep)
64cameraManager:changeCurrTarget("Planet", "Earth")
65return true
66end
67
68function switchCamToSpaceship(timestep)
69cameraManager:atachCurrCameraToWorldEntity( "NPC", "shutleOne")
70return true
71end
72
73function switchCamToStation(timestep)
74cameraManager:atachCurrCameraToWorldEntity("Building", "zhara")
75stationReached = true
76time = 0
77--cameraManager:detachCurrCamera()
78return true
79end
80
81function switchCamToBomber(timestep)
82cameraManager:changeCurrTarget( "NPC", "fighterTwo")
83return true
84end
85
86
87
88-- THE tick function
89
90function tick(timestep)
91time = time + timestep
92
93
94if bInit == 0 then
95  cameraManager:initFadeBlack()
96  gameWorld:showText("Earth Solar System");
97  bInit = 1
98end
99
100if time > 2 and bInit2 == 0 then
101   cameraManager:toggleFade()
102   bInit2 = 1
103end
104
105
106
107if time > 3 and time < 4 then
108   fighterThree:fire()
109end
110
111if not cameraSwitched then
112cameraManager:setCam("CameraOne")
113cameraManager:jumpCurrCam(125,0,-245)
114--cameraManager:atachCurrCameraToWorldEntity("NPC", "pirateOne")
115cameraManager:changeCurrTarget("Building", "zhara")
116cameraSwitched = true
117end
118
119if time > 4  and stationReached and not fadeout then
120cameraManager:toggleFade()
121fadeout = true
122end
123
124if time > 10 then
125   scrollingScreen:start()
126end
127
128
129if time > 6 and stationReached then
130gameWorld:setNextStoryName( "Space Station 1" ) 
131gameWorld:stop()
132return true
133end
134
135return false
136end 
Note: See TracBrowser for help on using the repository browser.