<LevelInfo
 name = "Jump"
 description = "Jump in space!"
 tags = "minigame"
 screenshot = "jump.png"
/>

<?lua
  include("HUDTemplates3.oxo")  
  include("jumpHUD.oxo")
  include("stats.oxo")
  include("templates/lodInformation.oxt")
?>

<Template name=jumpfigurecameras defaults=0>
  <JumpFigure>
    <camerapositions>
      <CameraPosition position="0,-150,0" absolute=true mouselook=false drag=false lookat="0,0,0"/>
    </camerapositions>
  </JumpFigure>
</Template>

<Template name=figureLeftHand defaults=0>
  <Model position="4.0,0.0,5.0" mesh="JumpFigureLeftHand.mesh" scale=1 pitch=90>
  </Model>
</Template>

<Template name=figureRightHand defaults=0>
  <Model position="-4.0,0.0,5.0" mesh="JumpFigureRightHand.mesh" scale=1 pitch=90>
  </Model>
</Template>

<Template name=jumpFigureTemplate>
  <JumpFigure camerapositiontemplate=jumpfigurecameras mouseFactor="100.0" modelLefthand=figureLeftHand  modelRighthand=figureRightHand rocketPos=10.0 propellerPos=10.0 bootsPos=-5.2 jumpSpeed=250.0 handMinAngle=-20 handMaxAngle=75 handSpeed=250 rocketSpeed=250.0 propellerSpeed=150.0>
    <attached>
      <Model position="0,0,0" mesh="JumpFigure.mesh" scale=1 pitch=90/>
    </attached>
  </JumpFigure>
</Template>

<Template name=jumpProjectileTemplate>
  <JumpProjectile>
    <attached>
      <Model mesh="JumpProjectile.mesh" scale=1  pitch=90/>
      <ParticleEmitter scale=1 pitch=0 roll=0 position="0, 0, 0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
    </attached>
  </JumpProjectile>
</Template>

<Template name=jumpPlatformStaticTemplate>
  <JumpPlatformStatic height=3 width=19>
    <attached>
      <Model mesh="JumpPlatform01.mesh" scale=1  pitch=90/>
      <Backlight scale=0.2 colour="0.9, 0.4, 0.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    </attached>
  </JumpPlatformStatic>
</Template>

<Template name=jumpPlatformHMoveTemplate>
  <JumpPlatformHMove height=3 width=19>
    <attached>
      <Model mesh="JumpPlatform02.mesh" scale=1  pitch=90/>
      <Backlight scale=0.2 colour="0.1, 0.1, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    </attached>
  </JumpPlatformHMove>
</Template>

<Template name=jumpPlatformVMoveTemplate>
  <JumpPlatformVMove height=3 width=19>
    <attached>
      <Model mesh="JumpPlatform03.mesh" scale=1  pitch=90/>
      <Backlight scale=0.2 colour="1.0, 0.1, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    </attached>
  </JumpPlatformVMove>
</Template>

<Template name=jumpPlatformDisappearTemplate>
  <JumpPlatformDisappear height=3 width=19>
    <attached>
      <Model mesh="JumpPlatform04.mesh" scale=1  pitch=90/>
      <Backlight scale=0.2 colour="0.1, 1.0, 0.1" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    </attached>
  </JumpPlatformDisappear>
</Template>

<Template name=jumpPlatformTimerTemplate>
  <JumpPlatformTimer height=3 width=19 effectPath="Orxonox/BigExplosion1part2" effectStartTime="0.4">
    <attached>
      <Model mesh="JumpPlatform05.mesh" scale=1  pitch=90/>
      <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="-4, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
      <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="0, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
      <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="4, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />      
    </attached>
  </JumpPlatformTimer>
</Template>

<Template name=jumpPlatformFakeTemplate>
  <JumpPlatformFake height=3 width=19>
    <attached>
      <Model mesh="JumpPlatform06.mesh" scale=1  pitch=90/>
      <ParticleEmitter scale3D="0.2,0.2,0.2" pitch=0 roll=0 position="0, 0, -2.5" source="Orxonox/sparks" lifetime=1.0 loop=1 startdelay=0.0 />
    </attached>
  </JumpPlatformFake>
</Template>

<Template name=jumpEnemy1Template>
  <JumpEnemy height=7 width=18>
    <attached>
      <Model mesh="JumpEnemy1.mesh" scale=1  pitch=90/>
      <FadingBillboard active=true scale=0.09 position="0, 0, 10" colour="0.2, 1.0, 0.65, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
      <Backlight scale=0.33 name=bltest position="0, 0, -10" colour="0.6, 0.8, 0.75, 0.7" width=25 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />            
    </attached>
  </JumpEnemy>
</Template>

<Template name=jumpEnemy2Template>
  <JumpEnemy height=8 width=20>
    <attached>
      <Model mesh="JumpEnemy2.mesh" scale=1  pitch=90/>
      <MovableEntity position="-17, 0, 4" rotationaxis="0, 1, 0" rotationrate=500 >
        <attached>
          <Model mesh="JumpEnemy2Wing.mesh" scale=1 pitch=90/>
        </attached>
      </MovableEntity>      
      <MovableEntity position="17, 0, 4" rotationaxis="0, 1, 0" rotationrate=500 >
        <attached>
          <Model mesh="JumpEnemy2Wing.mesh" scale=1 pitch=90/>
        </attached>
      </MovableEntity> 
      <ParticleEmitter scale3D="1.0,1.0,1.0" pitch=0 roll=0 position="-1, 0, -3" source="Orxonox/laser" lifetime=1.0 loop=1 startdelay=0.0 />
    </attached>
  </JumpEnemy>
</Template>

<Template name=jumpEnemy3Template>
  <JumpEnemy height=8.2 width=11.2>
    <attached>
      <Model mesh="JumpEnemy3.mesh" scale=1  pitch=90/>
      <Backlight scale3D="0.1, 0.1, 1.0" position="0, -11, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
      <Backlight scale3D="0.1, 0.1, 1.0" position="6.32, 5.5, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
      <Backlight scale3D="0.1, 0.1, 1.0" position="-6.32, 5.5, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>            
    </attached>
  </JumpEnemy>
</Template>

<Template name=jumpEnemy4Template>
  <JumpEnemy height=7.5 width=21.5 rotationaxis="0, 0, 1" rotationrate=40 >
    <attached>
      <Model mesh="JumpEnemy4.mesh" scale=1  pitch=90/>
    </attached>
  </JumpEnemy>
</Template>

<Template name=jumpSpringTemplate>
  <JumpSpring height=6 width=9.25>
    <attached>
      <Model mesh="JumpSpring.mesh" scale=1  rotationaxis="0, 0, 1" pitch=90 position="0.0, 0.0, 0.0"/>
    </attached>
  </JumpSpring>
</Template>

<Template name=jumpRocketTemplate>
  <JumpRocket height=8.5 width=13.5>
    <attached>
      <Model mesh="JumpRocket.mesh" scale=1  pitch=90 position="0.0, 0.0, 1.0"/>
    </attached>
  </JumpRocket>
</Template>

<Template name=jumpPropellerTemplate>
  <JumpPropeller height=4 width=15.5>
    <attached>
      <Model mesh="JumpPropeller.mesh" scale=1  pitch=90 position="0.0, 0.0, 1.0"/>
    </attached>
  </JumpPropeller>
</Template>

<Template name=jumpBootsTemplate>
  <JumpBoots height=5.2 width=3.5>
    <attached>
      <Model mesh="JumpBoots.mesh" scale=1  pitch=90 position="0.0, 0.0, 1.0"/>
    </attached>
  </JumpBoots>
</Template>

<Template name=jumpShieldTemplate>
  <JumpShield height=1.55 width=15.5>
    <attached>
      <Model mesh="JumpShield.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
    </attached>
  </JumpShield>
</Template>

<Level gametype = "Jump">
  <templates>
    <Template link=lodtemplate_default />
  </templates>
  <?lua include("includes/notifications.oxi") ?>

  <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true"/>
  <JumpBot />

  <Scene ambientlight="1.0, 1.0, 1.0" skybox="Orxonox/skyBoxBasic">
    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />

    <SpawnPoint position="991.729, -110.11, 435.404" orientation="0.534038, 0.563456, 0.212168, 0.593553" />

    <MovableEntity>
      <attached>
        <JumpCenterpoint
          name=jumpcenter
          dimension="120,80"
          sectionLength="150"
          platformSpeed="20"
          cameraOffset="10"

          platformStaticTemplate=jumpPlatformStaticTemplate
          platformHMoveTemplate=jumpPlatformHMoveTemplate
          platformVMoveTemplate=jumpPlatformVMoveTemplate
          platformDisappearTemplate=jumpPlatformDisappearTemplate
          platformTimerTemplate=jumpPlatformTimerTemplate
          platformFakeTemplate=jumpPlatformFakeTemplate          
          figureTemplate=jumpFigureTemplate
          projectileTemplate=jumpProjectileTemplate
          springTemplate=jumpSpringTemplate
          rocketTemplate=jumpRocketTemplate
          propellerTemplate=jumpPropellerTemplate
          bootsTemplate=jumpBootsTemplate
          shieldTemplate=jumpShieldTemplate
          enemy1Template=jumpEnemy1Template
          enemy2Template=jumpEnemy2Template
          enemy3Template=jumpEnemy3Template
          enemy4Template=jumpEnemy4Template
          >

          <attached>

            <Model position="0,0,-1000" mesh="JumpPlatform01.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpPlatform02.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpPlatform03.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpPlatform04.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpPlatform05.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpPlatform06.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpProjectile.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpEnemy1.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpEnemy2.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpEnemy3.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpEnemy4.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpSpring.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpRocket.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpPropeller.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpBoots.mesh" scale="1" />
            <Model position="0,0,-1000" mesh="JumpShield.mesh" scale="1" />
          </attached>
        </JumpCenterpoint>
      </attached>
    </MovableEntity>

    <EventDispatcher>
      <targets>
        <EventTarget target=scoreeffect_right />
        <EventTarget target=scoreeffect_center />
      </targets>
      <events>
        <spawn>
          <EventFilter>
            <names>
              <EventName name=right />
            </names>
            <EventListener event=jumpcenter />
          </EventFilter>
        </spawn>
      </events>
    </EventDispatcher>
    <EventDispatcher>
      <targets>
        <EventTarget target=scoreeffect_left />
        <EventTarget target=scoreeffect_center />
      </targets>
      <events>
        <spawn>
          <EventFilter>
            <names>
              <EventName name=left />
            </names>
            <EventListener event=jumpcenter />
          </EventFilter>
        </spawn>
      </events>
    </EventDispatcher>

  </Scene>
</Level>