-- Get objects from orxonox thisscript:addObject("FPSPlayer", "Player") thisscript:addObject("CameraMan", "cameraManager") thisscript:addObject("NPC", "IntroSpaceship") thisscript:addObjectAsName("GameWorld", "Moon Station", "gameWorld") -- =gameTitle thisscript:registerClass("Explosion") explosion = Explosion() -- Initialisation triggerInit = TickTrigger() --ScriptTrigger() triggerInit:setScript("intro.lua") triggerInit:setFunction("startIntro") --triggerInit:setActiveOnCreation(true) -- Camera2MoonstationCenter triggerMoonstation = SpaceTrigger() triggerMoonstation:setScript("intro.lua") triggerMoonstation:setFunction("showMoonstation") triggerMoonstation:setAbsCoor(-1253.895386, 727.938721, -268.726807) triggerMoonstation:setTarget("CameraIntro") triggerMoonstation:setRadius(150) --triggerMoonstation:setDebugDraw(true) -- Camera2Spaceship triggerShowCrash = SpaceTrigger() triggerShowCrash:setScript("intro.lua") triggerShowCrash:setFunction("showCrashingSpaceship") triggerShowCrash:setAbsCoor(-158.458618, 543.123169, 541.286926) triggerShowCrash:setTarget("CameraIntro") triggerShowCrash:setRadius(200) --triggerShowCrash:setDebugDraw(true) -- Explode triggerShowCrash = SpaceTrigger() triggerShowCrash:setScript("intro.lua") triggerShowCrash:setFunction("explodeSpaceship") triggerShowCrash:setAbsCoor(840.948486, 175.905289, -175.412460) triggerShowCrash:setTarget("IntroSpaceship") triggerShowCrash:setRadius(250) --triggerShowCrash:setDebugDraw(true) --hide crashing ship triggerShowCrash = SpaceTrigger() triggerShowCrash:setScript("intro.lua") triggerShowCrash:setFunction("hideCrashingSpaceship") triggerShowCrash:setAbsCoor(-100, -400, -110) triggerShowCrash:setTarget("IntroSpaceship") triggerShowCrash:setRadius(60) --triggerShowCrash:setDebugDraw(true) -- End of Intro triggerEndIntro = SpaceTrigger() triggerEndIntro:setScript("intro.lua") triggerEndIntro:setFunction("stopIntro") triggerEndIntro:setAbsCoor(719.431091, 79.719810, -149.023880) triggerEndIntro:setTarget("CameraIntro") triggerEndIntro:setRadius(110) --triggerEndIntro:setDebugDraw(true) -- Functions -------------------------------------------------- -- globals introRunning = false spaceshipCrashDelay = 2 boomSize = 100 pauseBurn = 0 exploded = false -- init function function startIntro(timestep) gameWorld:showText("Moon Surface 2102"); cameraManager:setCam("CameraIntro") cameraManager:jumpCurrCam(-1295.883301, 621.807922, -969.386780) cameraManager:changeCurrTarget("Planet", "Earth") cameraManager:initFadeBlack() cameraManager:toggleFade() IntroSpaceship:pause(true) --Player:pause(true) introRunning = true return true --just once end function showMoonstation(timestep) cameraManager:changeCurrTarget("Building", "MoonstationCenterHack") return true end function showCrashingSpaceship(timestep) cameraManager:changeCurrTarget("NPC", "IntroSpaceship") spaceshipCrashDelay = spaceshipCrashDelay - timestep if spaceshipCrashDelay<0 then --BUG this is a little hack cause if the target is mooving the camera switch would be imediate IntroSpaceship:pause(false) if pauseBurn==0 then pauseBurn = 5 explosion:setAbsCoor(IntroSpaceship:getAbsCoorX(),IntroSpaceship:getAbsCoorY(),IntroSpaceship:getAbsCoorZ()) explosion:explode(math.random()*50+50, math.random()*50+50, math.random()*50+50) if exploded then return true end else pauseBurn = pauseBurn - 1 end return false end return false end function explodeSpaceship(timestep) --gameWorld:showText("BOOOOOOOOOOOOOOOOM"); explosion:setAbsCoor(1003, 226, -102) explosion:explode(boomSize,boomSize,boomSize) boomSize = boomSize + 10 if boomSize == 600 then return true end exploded = true return false end function hideCrashingSpaceship(timestep) IntroSpaceship:pause(true) IntroSpaceship:setVisibility(false) return true end function stopIntro(timestep) cameraManager:setCam("GameWorldCamera") --Player:pause(false) introRunning = false return true end