Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added some enemies in vs-level

File size: 4.1 KB
RevLine 
[4850]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
[4867]7thisscript:registerClass("Explosion")
8explosion = Explosion()
[4904]9explosion:setExplosionSound("sounds/explosions/explosion_6_BIG.wav")
[4867]10
[4850]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)
[4867]24--triggerMoonstation:setDebugDraw(true)
[4850]25
[4867]26-- Camera2Spaceship
[4850]27triggerShowCrash = SpaceTrigger()
28triggerShowCrash:setScript("intro.lua")
29triggerShowCrash:setFunction("showCrashingSpaceship")
30triggerShowCrash:setAbsCoor(-158.458618, 543.123169, 541.286926)
31triggerShowCrash:setTarget("CameraIntro")
32triggerShowCrash:setRadius(200)
[4867]33--triggerShowCrash:setDebugDraw(true)
[4850]34
[4867]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
[4850]44--hide crashing ship
45triggerShowCrash = SpaceTrigger()
46triggerShowCrash:setScript("intro.lua")
47triggerShowCrash:setFunction("hideCrashingSpaceship")
48triggerShowCrash:setAbsCoor(-100, -400, -110)
49triggerShowCrash:setTarget("IntroSpaceship")
50triggerShowCrash:setRadius(60)
[4867]51--triggerShowCrash:setDebugDraw(true)
[4850]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)
[4867]60--triggerEndIntro:setDebugDraw(true)
[4850]61
62
63-- Functions --------------------------------------------------
64-- globals
65introRunning = false
[4901]66spaceshipCrashDelay = 3
[4867]67boomSize = 100
68pauseBurn = 0
69exploded = false
[4850]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)
[4867]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
[4894]102                                cameraManager:changeCurrTarget("ModelEntity", "destroyed fighter")
[4867]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
[4904]118        if boomSize > 650 then
119                --explosion:playSound()
[4850]120                return true
121        end
[4867]122        exploded = true
[4850]123        return false
124end
125
126function hideCrashingSpaceship(timestep)
127        IntroSpaceship:pause(true)
[4867]128        IntroSpaceship:setVisibility(false)
[4850]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.