Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/scripts/moonstation/intro.lua @ 4887

Last change on this file since 4887 was 4867, checked in by vkaenemi, 17 years ago

added subground level, intro script explosion, questfix, vis, levelswitch

File size: 3.9 KB
Line 
1-- Get objects from orxonox
2thisscript:addObject("FPSPlayer", "Player")
3thisscript:addObject("CameraMan", "cameraManager")
4thisscript:addObject("NPC", "IntroSpaceship")
5thisscript:addObjectAsName("GameWorld", "Moon Station", "gameWorld") -- =gameTitle
6
7thisscript:registerClass("Explosion")
8explosion = Explosion()
9
10-- Initialisation
11triggerInit =  TickTrigger() --ScriptTrigger()
12triggerInit:setScript("intro.lua")
13triggerInit:setFunction("startIntro")
14--triggerInit:setActiveOnCreation(true)
15
16-- Camera2MoonstationCenter
17triggerMoonstation = SpaceTrigger()
18triggerMoonstation:setScript("intro.lua")
19triggerMoonstation:setFunction("showMoonstation")
20triggerMoonstation:setAbsCoor(-1253.895386, 727.938721, -268.726807)
21triggerMoonstation:setTarget("CameraIntro")
22triggerMoonstation:setRadius(150)
23--triggerMoonstation:setDebugDraw(true)
24
25-- Camera2Spaceship
26triggerShowCrash = SpaceTrigger()
27triggerShowCrash:setScript("intro.lua")
28triggerShowCrash:setFunction("showCrashingSpaceship")
29triggerShowCrash:setAbsCoor(-158.458618, 543.123169, 541.286926)
30triggerShowCrash:setTarget("CameraIntro")
31triggerShowCrash:setRadius(200)
32--triggerShowCrash:setDebugDraw(true)
33
34-- Explode
35triggerShowCrash = SpaceTrigger()
36triggerShowCrash:setScript("intro.lua")
37triggerShowCrash:setFunction("explodeSpaceship")
38triggerShowCrash:setAbsCoor(840.948486, 175.905289, -175.412460)
39triggerShowCrash:setTarget("IntroSpaceship")
40triggerShowCrash:setRadius(250)
41--triggerShowCrash:setDebugDraw(true)
42
43--hide crashing ship
44triggerShowCrash = SpaceTrigger()
45triggerShowCrash:setScript("intro.lua")
46triggerShowCrash:setFunction("hideCrashingSpaceship")
47triggerShowCrash:setAbsCoor(-100, -400, -110)
48triggerShowCrash:setTarget("IntroSpaceship")
49triggerShowCrash:setRadius(60)
50--triggerShowCrash:setDebugDraw(true)
51
52-- End of Intro
53triggerEndIntro = SpaceTrigger()
54triggerEndIntro:setScript("intro.lua")
55triggerEndIntro:setFunction("stopIntro")
56triggerEndIntro:setAbsCoor(719.431091, 79.719810, -149.023880)
57triggerEndIntro:setTarget("CameraIntro")
58triggerEndIntro:setRadius(110)
59--triggerEndIntro:setDebugDraw(true)
60
61
62-- Functions --------------------------------------------------
63-- globals
64introRunning = false
65spaceshipCrashDelay = 2
66boomSize = 100
67pauseBurn = 0
68exploded = false
69
70-- init function
71function startIntro(timestep)
72        gameWorld:showText("Moon Surface 2102");
73        cameraManager:setCam("CameraIntro")
74        cameraManager:jumpCurrCam(-1295.883301, 621.807922, -969.386780)
75        cameraManager:changeCurrTarget("Planet", "Earth")
76        cameraManager:initFadeBlack()
77        cameraManager:toggleFade()
78       
79        IntroSpaceship:pause(true)
80        --Player:pause(true)
81        introRunning = true
82       
83        return true --just once
84end
85
86function showMoonstation(timestep)
87        cameraManager:changeCurrTarget("Building", "MoonstationCenterHack")
88        return true
89end
90
91function showCrashingSpaceship(timestep)
92        cameraManager:changeCurrTarget("NPC", "IntroSpaceship")
93        spaceshipCrashDelay = spaceshipCrashDelay - timestep
94        if spaceshipCrashDelay<0 then --BUG this is a little hack cause if the target is mooving the camera switch would be imediate
95                IntroSpaceship:pause(false)
96                if pauseBurn==0 then
97                        pauseBurn = 5
98                        explosion:setAbsCoor(IntroSpaceship:getAbsCoorX(),IntroSpaceship:getAbsCoorY(),IntroSpaceship:getAbsCoorZ())
99                        explosion:explode(math.random()*50+50, math.random()*50+50, math.random()*50+50)
100                        if exploded then
101                                return true
102                        end
103                else
104                        pauseBurn = pauseBurn - 1
105                end
106                return false
107        end
108        return false
109end
110
111function explodeSpaceship(timestep)
112        --gameWorld:showText("BOOOOOOOOOOOOOOOOM");
113        explosion:setAbsCoor(1003, 226, -102)
114        explosion:explode(boomSize,boomSize,boomSize)
115        boomSize = boomSize + 10
116        if boomSize == 600 then
117                return true
118        end
119        exploded = true
120        return false
121end
122
123function hideCrashingSpaceship(timestep)
124        IntroSpaceship:pause(true)
125        IntroSpaceship:setVisibility(false)
126        return true
127end 
128
129function stopIntro(timestep)
130        cameraManager:setCam("GameWorldCamera")
131        --Player:pause(false)
132        introRunning = false
133        return true
134end
135
Note: See TracBrowser for help on using the repository browser.