Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5265 was 4904, checked in by snellen, 17 years ago

added some enemies in vs-level

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