[Orxonox-commit 5444] r10107 - in code/branches/surfaceraceHS14: data/levels data/levels/templates src/modules src/modules/dodgerace
sriedel at orxonox.net
sriedel at orxonox.net
Wed Nov 5 13:15:56 CET 2014
Author: sriedel
Date: 2014-11-05 13:15:55 +0100 (Wed, 05 Nov 2014)
New Revision: 10107
Added:
code/branches/surfaceraceHS14/data/levels/DodgeRacePlus.oxw
code/branches/surfaceraceHS14/data/levels/DodgeRaceold.oxw
code/branches/surfaceraceHS14/src/modules/dodgerace/
code/branches/surfaceraceHS14/src/modules/dodgerace/CMakeLists.txt
code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderCenterPoint.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderCenterPoint.h
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemy.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemy.h
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemyShooter.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemyShooter.h
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderHUDinfo.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderHUDinfo.h
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderPrereqs.h
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderShip.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderShip.h
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeapon.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeapon.h
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeaponEnemy.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeaponEnemy.h
Removed:
code/branches/surfaceraceHS14/data/levels/DodgeRace
Modified:
code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw
code/branches/surfaceraceHS14/data/levels/templates/spaceshipDodgeRace.oxt
code/branches/surfaceraceHS14/data/levels/templates/spaceshipInvader.oxt
Log:
New commitment trial
Deleted: code/branches/surfaceraceHS14/data/levels/DodgeRace
===================================================================
--- code/branches/surfaceraceHS14/data/levels/DodgeRace 2014-11-04 07:04:19 UTC (rev 10106)
+++ code/branches/surfaceraceHS14/data/levels/DodgeRace 2014-11-05 12:15:55 UTC (rev 10107)
@@ -1,34 +0,0 @@
-<LevelInfo
- name = "Dodge Race Test"
- description = "A level with hardly anything in it (at the moment)."
- tags = "test"
- screenshot = "emptylevel.png"
-/>
-
-<?lua
- include("stats.oxo")
- include("HUDTemplates3.oxo")
- include("templates/lodInformation.oxt")
-?>
-
-<?lua
- include("templates/spaceshipDodgeRace.oxt")
-?>
-
-<Level>
- <templates>
- <Template link=lodtemplate_default />
- </templates>
- <?lua include("includes/notifications.oxi") ?>
-
- <Scene
- ambientlight = "0.8, 0.8, 0.8"
- skybox = "Orxonox/Starbox"
- >
-
- <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 team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipDodgeRace />
-
- </Scene>
-</Level>
-
Modified: code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw
===================================================================
--- code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw 2014-11-04 07:04:19 UTC (rev 10106)
+++ code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw 2014-11-05 12:15:55 UTC (rev 10107)
@@ -1,21 +1,30 @@
+<!--
+TODO:
+ Replace bottom's texture. It just does not look good.
+-->
+
<LevelInfo
name = "Dodge Race Test"
- description = "A level with hardly anything in it (at the moment)."
+ description = "Race on a planet's surface. Try to reach the goal in 70 Seconds."
+ screenshot = "surfaceRace.png"
tags = "minigame"
- screenshot = "emptylevel.png"
/>
+
<?lua
include("stats.oxo")
include("HUDTemplates3.oxo")
include("templates/lodInformation.oxt")
-?>
+ include("templates/spaceshipRace.oxt")
+ include("templates/pickupRepresentationTemplates.oxt")
-<?lua
- include("templates/spaceshipDodgeRace.oxt")
?>
-<Level gametype = DodgeRace>
+
+<Level
+ gametype = SpaceRace
+>
+
<templates>
<Template link=lodtemplate_default />
</templates>
@@ -24,15 +33,430 @@
<Scene
ambientlight = "2.0, 2.0, 2.0"
skybox = "Orxonox/skyBoxClouds"
- gravity = "0,0,0"
+ gravity = "0,-75,0"
negativeWorldRange = "-100000, -100000, -100000"
positiveWorldRange = " 100000, 100000, 100000"
hasPhysics = true
>
- <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 team=0 position="-200,0,0" lookat="0,0,0" spawnclass=DodgeShip pawndesign=spaceshipDodgeRace />
+ <?lua
+ include("includes/pickups.oxi")
+ ?>
+
+ <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"/>
+
+
+
+<SpaceRaceManager>
+ <checkpoints>
+ <RaceCheckPoint name="checkpoint1" position="0,8050,-1000" direction="0,1,0" collisionType="static" scale="4" distance="150" checkpointindex="0" islast="false" nextcheckpoints="1,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+
+<!--
+ <Model position="0,0,55" mesh="testcube.mesh" scale3D="110,20,20" />
+ <Model position="0,0,-55" mesh="testcube.mesh" scale3D="110,20,20" />
+ <Model position="55,0,0" mesh="testcube.mesh" scale3D="20,20,110" />
+ <Model position="-55,0,0" mesh="testcube.mesh" scale3D="20,20,110" />
+
+-->
+
+
+ </attached>
+
+
+
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+
+
+
+ </RaceCheckPoint>
+
+<RaceCheckPoint name="checkpoint2" position="1000,8050,-4000" direction="0,1,0" roll="45" collisionType="static" scale="4" distance="150" checkpointindex="1" islast="false" nextcheckpoints="2,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+
+
+ <collisionShapes>
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+ </collisionShapes>
+ </RaceCheckPoint>
+
+
+
+<RaceCheckPoint name="checkpoint3" position="3000,8050,-4000" direction="0,1,0" roll="-45" collisionType="static" scale="4" distance="150" checkpointindex="2" islast="false" nextcheckpoints="3,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+ </RaceCheckPoint>
+
+
+<RaceCheckPoint name="checkpoint4" position="4000,8050,-1000" direction="0,1,0" roll="0" collisionType="static" scale="4" distance="150" checkpointindex="3" islast="false" nextcheckpoints="4,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+ </RaceCheckPoint>
+
+
+<RaceCheckPoint name="checkpoint5" position="4000,8050,0" direction="0,1,0" roll="0" collisionType="static" scale="4" distance="150" checkpointindex="4" islast="false" nextcheckpoints="5,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+ </RaceCheckPoint>
+
+
+<RaceCheckPoint name="checkpoint6" position="3000,8050,1000" direction="0,1,0" roll="45" collisionType="static" scale="4" distance="150" checkpointindex="5" islast="false" nextcheckpoints="6,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+ </RaceCheckPoint>
+
+
+
+<RaceCheckPoint name="checkpoint7" position="0,8050,2000" direction="0,1,0" roll="90" collisionType="static" scale="4" distance="150" checkpointindex="6" islast="false" nextcheckpoints="7,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+ </RaceCheckPoint>
+
+
+
+<RaceCheckPoint name="checkpoint8" position="-4000,8050,3000" direction="0,1,0" roll="45" collisionType="static" scale="4" distance="150" checkpointindex="7" islast="false" nextcheckpoints="8,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+ </collisionShapes>
+ </RaceCheckPoint>
+
+
+<RaceCheckPoint name="checkpoint9" position="-4000,8050,5000" direction="0,1,0" roll="-45" collisionType="static" scale="4" distance="150" checkpointindex="8" islast="false" nextcheckpoints="9,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+ </RaceCheckPoint>
+
+
+<RaceCheckPoint name="checkpoint10" position="-3000,8050,6000" direction="0,1,0" roll="90" collisionType="static" scale="4" distance="150" checkpointindex="9" islast="false" nextcheckpoints="10,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+ </RaceCheckPoint>
+
+<RaceCheckPoint name="checkpoint11" position="0,8050,6000" direction="0,1,0" roll="90" collisionType="static" scale="4" distance="120" checkpointindex="10" islast="false" nextcheckpoints="11,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+ </RaceCheckPoint>
+
+<RaceCheckPoint name="checkpoint12" position="6000,8050,6000" direction="0,1,0" roll="45" collisionType="static" scale="4" distance="150" checkpointindex="11" islast="false" nextcheckpoints="12,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+ </RaceCheckPoint>
+
+
+
+<RaceCheckPoint name="checkpoint13" position="5500,8050,3000" direction="0,1,0" roll="0" collisionType="static" scale="4" distance="150" checkpointindex="12" islast="false" nextcheckpoints="13,-1,-1">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+ </collisionShapes>
+ </RaceCheckPoint>
+
+
+<RaceCheckPoint name="checkpoint14" position="6000,8050,-5000" direction="0,1,0" roll="0" collisionType="static" scale="4" distance="150" checkpointindex="13" islast="true" >
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+ </collisionShapes>
+ </RaceCheckPoint>
+
+
+</checkpoints>
+</SpaceRaceManager>
+
+ <SpawnPoint team=0 position="0,8050,0" lookat="0,8000,-8000" spawnclass=DodgeShip pawndesign=spaceshipDodgeRace />
+
+
+ <!-- -----------------------Zylinder---------------------------- -->
+<StaticEntity position="2750,8050,6000" direction="1,0,0" roll="90" scale="4" collisionType=static mass=100000 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cylinder.mesh" scale3D="100,100,400" />
+ <!--
+ <Model position="0,80,600" mesh="testcube.mesh" scale3D="90,18,-600" />
+ <Model position="0,-80,600" mesh="testcube.mesh" scale3D="90,18,-600" />
+ <Model position="80,0,600" mesh="testcube.mesh" scale3D="18,90,-600" />
+ <Model position="-80,0,600" mesh="testcube.mesh" scale3D="18,09,-600" />
+ -->
+
+ </attached>
+
+
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,320,2400" halfExtents="360,72,2400" />
+ <BoxCollisionShape position="0,-320,2400" halfExtents="360,72,2400" />
+ <BoxCollisionShape position="320,0,2400" halfExtents="72,360,2400" />
+ <BoxCollisionShape position="-320,0,2400" halfExtents="72,360,2400" />
+
+
+
+ </collisionShapes>
+
+ </StaticEntity>
+
+<!-- ------------------Cube between gate 4 and 5----------------- -->
+<StaticEntity position="4465,8050,-500" direction="0,0,0" scale="1" collisionType=static mass=100000 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="blackcube.mesh" scale3D="450,600,50" />
+<!--
+ <Model position="0,0,0" mesh="testcube.mesh" scale3D="450,600,50" />
+ -->
+
+ </attached>
+
+
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,0" halfExtents="450,600,50" />
+
+ </collisionShapes>
+
+ </StaticEntity>
+
+<StaticEntity position="3535,8050,-500" direction="0,0,0" scale="1" collisionType=static mass=100000 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="blackcube.mesh" scale3D="450,600,50" />
+<!--
+ <Model position="0,0,0" mesh="testcube.mesh" scale3D="450,600,50" />
+ -->
+
+ </attached>
+
+
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,0" halfExtents="450,600,50" />
+
+ </collisionShapes>
+
+ </StaticEntity>
+
+
+
+
+ <!-- ------------------Boden----------------- -->
+ <StaticEntity position="0,0,0" direction="0,0,0" collisionType=static mass=100000 friction=0.01>
+ <attached>
+ <Model position="0,0,0" mesh="CubeGround.mesh" scale3D="8000,8000,8000" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,50,0" halfExtents="8000,8000,8000" />um j?:P"{
+
+ </collisionShapes>
+</StaticEntity>
+
+
+<!-- ---------------------PickUp---------------------- -->
+
+
+ <PickupSpawner pickup=smallspeedpickup position="4000,8050,0" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8" />
+ <PickupSpawner pickup=mediumspeedpickup position="5500,8100,2000" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8" />
+ <PickupSpawner pickup="mediumshrinkpickup" position="3000,8050,-4000" triggerDistance="40" respawnTime="60" maxSpawnedItems="5" scale="8" />
+
+
+
+
+ <!-- ---------------asteroid ellipse----------------- -->
+
+ <?lua
+ max = 15
+ for i = 0, max, 1
+ do
+ x=-12000
+ y=10000
+ z=-12000
+
+ ?>
+ <?lua
+ for k = 1, 15, 1
+ do
+ j = math.random()
+ ?>
+
+ <MovableEntity
+ position = "<?lua print(x + math.random() * 20000) ?>,<?lua print(y + math.random() * 5000) ?>,<?lua print(z + math.random() * 20000) ?>"
+ collisionType = "dynamic"
+ linearDamping = "0.5"
+ angularDamping = "0.5"
+ collisiondamage = "100"
+ enablecollisiondamage = "true"
+ scale="<?lua print(j * 5) ?>" >
+ <attached>
+ <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh">
+ <?lua if k == 0 then ?><attached><!-- ---------asteroid fog----- -->
+ <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
+ </attached> <?lua end ?>
+ </Model>
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="<?lua print(j * 80) ?>" />
+ </collisionShapes>
+ </MovableEntity>
+ <?lua
+ end
+ ?>
+ <?lua end ?>
+ <!-- SOUNDS & MUSIC -->
+ <WorldSound name="scoreSound" position="0,8050,0" source="sounds/ReadyGo.ogg" >
+ <events>
+ <play>
+ <EventListener event="start" />
+ </play>
+ </events>
+ </WorldSound>
+ <DistanceTrigger name="start" position="0,8050,0" target="Pawn" distance=100 stayActive="true" delay=0.5 />
+ <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" />
+
</Scene>
</Level>
Added: code/branches/surfaceraceHS14/data/levels/DodgeRacePlus.oxw
===================================================================
--- code/branches/surfaceraceHS14/data/levels/DodgeRacePlus.oxw (rev 0)
+++ code/branches/surfaceraceHS14/data/levels/DodgeRacePlus.oxw 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,77 @@
+<LevelInfo
+ name = "DodgeRacePlus"
+ description = "Just a copy of SpaceInvaders so far"
+ tags = "minigame"
+ screenshot = "orxonoxArcade.png"
+/>
+<?lua
+ include("stats.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff2.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipInvader.oxt")
+ include("templates/spaceshipDodgeRace.oxt")
+ include("templates/enemyInvader.oxt")
+ include("overlays/InvaderHUD.oxo")
+?>
+
+<Level gametype = Invader>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <!-- ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox" -->
+ <Scene
+ ambientlight = "0.8, 0.7, 0.4"
+ skybox = "Orxonox/skyBoxBasic"
+ >
+
+ <WorldAmbientSound
+ source="Earth.ogg"
+ looping="true"
+ playOnLoad="true"
+ />
+
+ <!-- <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"/> -->
+ <Light type=directional position="1100, 11000, -7000" lookat="0, 0, 0" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+ <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=InvaderShip pawndesign=spaceshipDodgeRace />
+
+ <DistanceTrigger name="start" position="-200,0,0" target="Pawn" distance=10 stayActive="true" delay=0 />
+
+
+ <InvaderCenterPoint name=invadercenter />
+
+ <?lua
+ for i = 1, 300, 1 do
+ j = math.random()
+ ?>
+
+ <MovableEntity
+ position = "<?lua print(math.random()* 40000 + 1000) ?>,-1000,<?lua print(math.random() * 4000 - 2000) ?>"
+ collisionType = dynamic
+ linearDamping = 0.8
+ angularDamping = 0
+ scale = "<?lua print(j * 150)?>"
+ collisiondamage = 0
+ enablecollisiondamage = true
+ >
+ <attached>
+ <Model mass="<?lua print(j * 1000) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="<?lua print(j * 350) ?>" />
+ </collisionShapes>
+ </MovableEntity>
+
+ <?lua
+ end
+ ?>
+
+ </Scene>
+</Level>
+
Added: code/branches/surfaceraceHS14/data/levels/DodgeRaceold.oxw
===================================================================
--- code/branches/surfaceraceHS14/data/levels/DodgeRaceold.oxw (rev 0)
+++ code/branches/surfaceraceHS14/data/levels/DodgeRaceold.oxw 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,48 @@
+<LevelInfo
+ name = "Dodge Race Test x"
+ description = "A level with hardly anything in it (at the moment)."
+ tags = "minigame"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipDodgeRace.oxt")
+?>
+
+<Level gametype = Deathmatch>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "2.0, 2.0, 2.0"
+ skybox = "Orxonox/skyBoxClouds"
+ gravity = "0,0,0"
+ negativeWorldRange = "-100000, -100000, -100000"
+ positiveWorldRange = " 100000, 100000, 100000"
+ hasPhysics = true
+ >
+
+ <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 team=0 position="-200,0,0" lookat="0,0,0" spawnclass=DodgeShip pawndesign=spaceshipDodgeRace />
+
+ </Scene>
+</Level>
+
+ <!-- ------------------Boden----------------- -->
+ <StaticEntity position="0,0,0" direction="0,0,0" collisionType=static mass=100000 friction=0.01>
+ <attached>
+ <Model position="0,0,0" mesh="CubeGround.mesh" scale3D="8000,8000,8000" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,50,0" halfExtents="8000,8000,8000" />um j?:P"{
+
+ </collisionShapes>
+</StaticEntity>
Modified: code/branches/surfaceraceHS14/data/levels/templates/spaceshipDodgeRace.oxt
===================================================================
--- code/branches/surfaceraceHS14/data/levels/templates/spaceshipDodgeRace.oxt 2014-11-04 07:04:19 UTC (rev 10106)
+++ code/branches/surfaceraceHS14/data/levels/templates/spaceshipDodgeRace.oxt 2014-11-05 12:15:55 UTC (rev 10107)
@@ -1,45 +1,48 @@
<Template name=spaceshipDodgeRace>
- <SpaceShip
+ <InvaderShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshipescortcameras
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 4
- health = 120
+ health = 80
maxhealth = 200
initialhealth = 80
shieldhealth = 35
initialshieldhealth = 35
- maxshieldhealth = 0
- shieldabsorption = 0
- reloadrate = 1000
- reloadwaittime = 0
+ maxshieldhealth = 60
+ shieldabsorption = 0.9
+ reloadrate = 1
+ reloadwaittime = 1
primaryThrust = 150
auxilaryThrust = 30
- rotationThrust = 0
+ rotationThrust = 50
lift = 1;
stallSpeed = 220;
- boostPower = 200
- boostPowerRate = 0
- boostRate = 0
- boostCooldownDuration = 0
+ boostPower = 20
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
- shakeFrequency = 0
- shakeAmplitude = 0
+ shakeFrequency = 15
+ shakeAmplitude = 6
collisionType = "dynamic"
- mass = 80
+ mass = 4200000
linearDamping = 0.7
angularDamping = 0.9999999
+
+ collisiondamage = 100
+ enablecollisiondamage = true
>
<engines>
- <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipescortengine />
- <MultiStateEngine position="-7.6, 0, 0" template=spaceshipescortengine />
+ <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipinvaderengine />
+ <MultiStateEngine position="-7.6, 0, 0" template=spaceshipinvaderengine />
</engines>
<attached>
<Model position="0,0,0" yaw=90 pitch=0 roll=0 scale=4 mesh="escortShip.mesh" />
@@ -56,38 +59,39 @@
<BoxCollisionShape position="0, 0,-12" halfExtents="4 , 4 ,7" />
</collisionShapes>
<?lua
- include("../includes/weaponSettingsEscort.oxi")
+ include("../includes/invaderWeapon.oxi")
?>
- </SpaceShip>
+ </InvaderShip>
</Template>
<Template name=spaceshipescortcameras defaults=0>
- <SpaceShip>
+ <InvaderShip>
<camerapositions>
- <CameraPosition position="0,15, 60" drag=true mouselook=true />
- <CameraPosition position="0,20, 90" drag=true mouselook=true />
- <CameraPosition position="0,30,120" drag=true mouselook=true />
+ <!-- <CameraPosition position="0,15, 60" drag=true mouselook=true />
+ <CameraPosition position="0,20, 90" drag=true mouselook=true /> -->
+ <CameraPosition position="0,30,120" direction="0, 0, -1" drag=false mouselook=true />
+ <CameraPosition position="0,300,-100" direction="0, -1, 0" drag=false mouselook=true />
</camerapositions>
- </SpaceShip>
+ </InvaderShip>
</Template>
-<Template name=spaceshipescortengine baseclass=MultiStateEngine>
+<Template name=spaceshipinvaderengine baseclass=MultiStateEngine>
<MultiStateEngine
boostfactor = 2.2
speedfront = 200
- speedback = 700
- speedleftright = 700
- speedupdown = 700
+ speedback = 70
+ speedleftright = 70
+ speedupdown = 70
defEngineSndNormal = "sounds/Engine_low.ogg"
defEngineSndBoost = "sounds/Engine_high.ogg"
- accelerationfront = 800
- accelerationbrake = 900
- accelerationback = 1000
- accelerationleftright = 800
- accelerationupdown = 800
+ accelerationfront = 700
+ accelerationbrake = 700
+ accelerationback = 125
+ accelerationleftright = 125
+ accelerationupdown = 125
>
<EffectContainer condition="idle">
<WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" looping=1 active=false/>
@@ -109,4 +113,4 @@
</EffectContainer>
</MultiStateEngine>
-</Template>
+</Template>
\ No newline at end of file
Modified: code/branches/surfaceraceHS14/data/levels/templates/spaceshipInvader.oxt
===================================================================
--- code/branches/surfaceraceHS14/data/levels/templates/spaceshipInvader.oxt 2014-11-04 07:04:19 UTC (rev 10106)
+++ code/branches/surfaceraceHS14/data/levels/templates/spaceshipInvader.oxt 2014-11-05 12:15:55 UTC (rev 10107)
@@ -67,9 +67,9 @@
<Template name=spaceshipescortcameras defaults=0>
<InvaderShip>
<camerapositions>
-<!-- <CameraPosition position="0,15, 60" drag=true mouselook=true />
- <CameraPosition position="0,20, 90" drag=true mouselook=true />
- <CameraPosition position="0,30,120" drag=true mouselook=true /> -->
+ <!-- <CameraPosition position="0,15, 60" drag=true mouselook=true />
+ <CameraPosition position="0,20, 90" drag=true mouselook=true /> -->
+ <CameraPosition position="0,30,120" direction="0, 0, -1" drag=false mouselook=true />
<CameraPosition position="0,300,-100" direction="0, -1, 0" drag=false mouselook=true />
</camerapositions>
</InvaderShip>
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/CMakeLists.txt
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/CMakeLists.txt (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/CMakeLists.txt 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,22 @@
+SET_SOURCE_FILES(Invader_SRC_FILES
+BUILD_UNIT InvaderBuildUnit.cc
+ Invader.cc
+ InvaderCenterPoint.cc
+ InvaderShip.cc
+ InvaderEnemy.cc
+ InvaderEnemyShooter.cc
+ InvaderWeapon.cc
+ InvaderWeaponEnemy.cc
+ InvaderHUDinfo.cc
+END_BUILD_UNIT
+)
+
+ORXONOX_ADD_LIBRARY(invader
+ MODULE
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ overlays
+ weapons
+ SOURCE_FILES ${Invader_SRC_FILES}
+)
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.cc 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,187 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Invader.cc
+ @brief Implementation of the Invader class.
+*/
+
+#include "DodgeRace.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/command/Executor.h"
+#include "core/config/ConfigValueIncludes.h"
+
+#include "gamestates/GSLevel.h"
+#include "chat/ChatManager.h"
+
+// ! HACK
+#include "infos/PlayerInfo.h"
+
+#include "InvaderCenterPoint.h"
+#include "InvaderShip.h"
+#include "InvaderEnemy.h"
+#include "InvaderEnemyShooter.h"
+
+#include "core/command/ConsoleCommand.h"
+#include "worldentities/BigExplosion.h"
+
+namespace orxonox
+{
+ RegisterUnloadableClass(Invader);
+
+ DodgeRace::DodgeRace(Context* context) : Deathmatch(context)
+ {
+ RegisterObject(DodgeRace);
+ this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
+ this->center_ = 0;
+ init();
+ this->setHUDTemplate("InvaderHUD");
+ }
+
+ void DodgeRace::init()
+ {
+ bEndGame = false;
+ lives = 3;
+ level = 1;
+ point = 0;
+ bShowLevel = false;
+ multiplier = 1;
+ b_combo = false;
+ // spawn enemy every 3.5 seconds
+ enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Invader::spawnEnemy, this)));
+ comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&Invader::comboControll, this)));
+ }
+
+ void DodgeRace::levelUp()
+ {
+ level++;
+ if (getPlayer() != NULL)
+ {
+ for (int i = 0; i < 7; i++)
+ {
+ WeakPtr<BigExplosion> chunk = new BigExplosion(this->center_->getContext());
+ chunk->setPosition(Vector3(600, 0, 100.f * i - 300));
+ chunk->setVelocity(Vector3(1000, 0, 0)); //player->getVelocity()
+ chunk->setScale(20);
+ }
+ }
+ addPoints(multiplier * 42);
+ multiplier *= 2;
+ toggleShowLevel();
+ showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&DodgeRace::toggleShowLevel, this)));
+ }
+
+ WeakPtr<InvaderShip> DodgeRace::getPlayer()
+ {
+ if (player == NULL)
+ {
+ for (ObjectList<InvaderShip>::iterator it = ObjectList<InvaderShip>::begin(); it != ObjectList<InvaderShip>::end(); ++it)
+ player = *it;
+ }
+ return player;
+ }
+
+ void DodgeRace::spawnEnemy()
+ {
+ if (getPlayer() == NULL)
+ return;
+
+ for (int i = 0; i < (3*log10(static_cast<double>(level)) + 1); i++)
+ {
+ WeakPtr<InvaderEnemy> newPawn;
+ if (rand() % 42/(1 + level*level) == 0)
+ {
+ newPawn = new InvaderEnemyShooter(this->center_->getContext());
+ newPawn->addTemplate("enemyinvadershooter");
+ }
+ else
+ {
+ newPawn = new InvaderEnemy(this->center_->getContext());
+ newPawn->addTemplate("enemyinvader");
+ }
+ newPawn->setPlayer(player);
+ newPawn->level = level;
+ // spawn enemy at random points in front of player.
+ newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
+ }
+ }
+
+ void DodgeRace::costLife()
+ {
+ lives--;
+ multiplier = 1;
+ // end the game in 30 seconds.
+ if (lives <= 0)
+ enemySpawnTimer.setTimer(30.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
+ };
+
+ void DodgeRace::comboControll()
+ {
+ if (b_combo)
+ multiplier++;
+ // if no combo was performed before, reset multiplier
+ else
+ multiplier = 1;
+ b_combo = false;
+ }
+
+ void DodgeRace::start()
+ {
+ init();
+ // Set variable to temporarily force the player to spawn.
+ this->bForceSpawn_ = true;
+
+ if (this->center_ == NULL) // abandon mission!
+ {
+ orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl;
+ GSLevel::startMainMenu();
+ return;
+ }
+ // Call start for the parent class.
+ Deathmatch::start();
+ }
+ void DodgeRace::addPoints(int numPoints)
+ {
+ if (!bEndGame)
+ {
+ point += numPoints * multiplier;
+ b_combo = true;
+ }
+ }
+
+ void DodgeRace::end()
+ {
+ // DON'T CALL THIS!
+ // Deathmatch::end();
+ // It will misteriously crash the game!
+ // Instead startMainMenu, this won't crash.
+ GSLevel::startMainMenu();
+ }
+}
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,94 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DodgeRace.h
+ @brief Gametype.
+ @ingroup DodgeRace
+*/
+
+#ifndef _DodgeRace_H__
+#define _DodgeRace_H__
+
+#include "dodgerace/InvaderPrereqs.h"
+
+#include "gametypes/Deathmatch.h"
+
+#include "InvaderCenterPoint.h"
+
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+
+ class _InvaderExport DodgeRace : public Deathmatch
+ {
+ public:
+ DodgeRace(Context* context);
+
+ virtual void start();
+ virtual void end();
+ virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
+
+ void spawnEnemy();
+
+ void setCenterpoint(InvaderCenterPoint* center)
+ { this->center_ = center; }
+
+ int getLives(){return this->lives;}
+ int getLevel(){return this->level;}
+ int getPoints(){return this->point;}
+ int getMultiplier(){return this->multiplier;}
+
+ void costLife();
+ void levelUp();
+ void addPoints(int numPoints);
+ // checks if multiplier should be reset.
+ void comboControll();
+ void init();
+ int lives;
+ int multiplier;
+ bool bEndGame;
+ bool bShowLevel;
+ private:
+ void toggleShowLevel(){bShowLevel = !bShowLevel;}
+ WeakPtr<InvaderShip> getPlayer();
+ WeakPtr<InvaderCenterPoint> center_;
+ WeakPtr<InvaderShip> player;
+
+ Timer enemySpawnTimer;
+ Timer comboTimer;
+ Timer showLevelTimer;
+ //Context* context;
+ int level;
+ int point;
+ bool b_combo;
+ };
+}
+
+#endif /* _DodgeRace_H__ */
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderCenterPoint.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderCenterPoint.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderCenterPoint.cc 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,72 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderCenterPoint.cc
+ @brief Implementation of the InvaderCenterPoint class.
+*/
+
+#include "InvaderCenterPoint.h"
+
+#include "core/CoreIncludes.h"
+
+#include "Invader.h"
+
+namespace orxonox
+{
+ RegisterClass(InvaderCenterPoint);
+
+ InvaderCenterPoint::InvaderCenterPoint(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(InvaderCenterPoint);
+
+ this->checkGametype();
+ }
+
+ void InvaderCenterPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(InvaderCenterPoint, XMLPort, xmlelement, mode);
+ }
+
+ void InvaderCenterPoint::changedGametype()
+ {
+ SUPER(InvaderCenterPoint, changedGametype);
+
+ // Check, whether it's still Invader.
+ this->checkGametype();
+ }
+
+ void InvaderCenterPoint::checkGametype()
+ {
+ if (this->getGametype() != NULL && this->getGametype()->isA(Class(Invader)))
+ {
+ Invader* InvaderGametype = orxonox_cast<Invader*>(this->getGametype().get());
+ InvaderGametype->setCenterpoint(this);
+ }
+ }
+}
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderCenterPoint.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderCenterPoint.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderCenterPoint.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,58 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderCenterPoint.h
+ @brief Declaration of the InvaderCenterPoint class.
+ @ingroup Invader
+*/
+
+#ifndef _InvaderCenterPoint_H__
+#define _InvaderCenterPoint_H__
+
+#include "invader/InvaderPrereqs.h"
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _InvaderExport InvaderCenterPoint : public StaticEntity
+ {
+ public:
+ InvaderCenterPoint(Context* context); //checks whether the gametype is actually Invader.
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void changedGametype(); //!< Is called when the gametype has changed.
+ private:
+ void checkGametype();
+
+ };
+}
+
+#endif /* _InvaderCenterPoint_H__ */
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemy.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemy.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemy.cc 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,87 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderEnemy.h
+ @brief Declaration of the InvaderEnemy class.
+*/
+
+#include "invader/InvaderPrereqs.h"
+#include "InvaderEnemy.h"
+#include "InvaderShip.h"
+
+namespace orxonox
+{
+ RegisterClass(InvaderEnemy);
+
+ InvaderEnemy::InvaderEnemy(Context* context) : Pawn(context)
+ {
+ RegisterObject(InvaderEnemy);
+ enableCollisionCallback();
+ lifetime = 0;
+ }
+
+ void InvaderEnemy::tick(float dt)
+ {
+ lifetime += dt;
+ // die after 5 seconds.
+ if (lifetime > 5000)
+ removeHealth(2000);
+
+ if (player != NULL)
+ {
+ float newZ = 2/(pow(abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * (player->getPosition().z - getPosition().z);
+ setVelocity(Vector3(1000.f - level * 100 , 0, newZ));
+ }
+ SUPER(InvaderEnemy, tick, dt);
+ }
+
+ inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ {
+ if(orxonox_cast<InvaderShip*>(otherObject))
+ removeHealth(2000);
+ return false;
+ }
+
+ WeakPtr<Invader> InvaderEnemy::getGame()
+ {
+ if (game == NULL)
+ {
+ for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)
+ game = *it;
+ }
+ return game;
+ }
+
+ void InvaderEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ {
+ Pawn::damage(damage, healthdamage, shielddamage, originator);
+ if (getGame() && orxonox_cast<InvaderShip*>(originator) != NULL && getHealth() <= 0)
+ getGame()->addPoints(42);
+ }
+}
\ No newline at end of file
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemy.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemy.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemy.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,72 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderEnemy.h
+ @brief Declaration of the InvaderEnemy class.
+*/
+
+#ifndef _InvaderEnemy_H__
+#define _InvaderEnemy_H__
+
+#include "invader/InvaderPrereqs.h"
+
+#include "worldentities/pawns/SpaceShip.h"
+
+namespace orxonox
+{
+ class _InvaderExport InvaderEnemy : public Pawn
+ {
+ public:
+ InvaderEnemy(Context* context);
+
+ virtual void tick(float dt);
+ virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator);
+ virtual void setPlayer(WeakPtr<InvaderShip> player){this->player = player;}
+
+ int level;
+ protected:
+ WeakPtr<Invader> getGame();
+ WeakPtr<Invader> game;
+ WeakPtr<InvaderShip> player;
+ Camera* camera;
+ bool isFireing;
+ float speed, damping;
+ float lastTimeFront, lastTimeLeft;
+ float lifetime;
+ struct Velocity
+ {
+ float x;
+ float y;
+ } velocity, desiredVelocity;
+
+ };
+}
+
+#endif /* _InvaderEnemy_H__ */
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemyShooter.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemyShooter.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemyShooter.cc 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,79 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderEnemyShooter.h
+ @brief Declaration of the InvaderEnemyShooter class.
+*/
+
+#include "invader/InvaderPrereqs.h"
+#include "InvaderEnemyShooter.h"
+// #include "worldentities/pawns/SpaceShip.h"
+
+namespace orxonox
+{
+ RegisterClass(InvaderEnemyShooter);
+
+ InvaderEnemyShooter::InvaderEnemyShooter(Context* context) : InvaderEnemy(context)
+ {
+ RegisterObject(InvaderEnemyShooter);
+ enableCollisionCallback();
+ lifetime = 0;
+ // shoot every second
+ shootTimer.setTimer(1.0f, true, createExecutor(createFunctor(&InvaderEnemyShooter::shoot, this)));
+ }
+
+ void InvaderEnemyShooter::tick(float dt)
+ {
+ lifetime += dt;
+ // die after 20 seconds.
+ if (lifetime > 20000)
+ removeHealth(2000);
+
+ if (player != NULL)
+ {
+ float distPlayer = player->getPosition().z - getPosition().z;
+ // orxout() << "i'm different!" << endl;
+ float newZ = 2/(pow(abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * distPlayer;
+ setVelocity(Vector3(950 - abs(distPlayer), 0, newZ));
+ }
+ Pawn::tick(dt);
+ }
+
+ void InvaderEnemyShooter::shoot()
+ {
+ ControllableEntity::fire(0);
+ }
+
+ void InvaderEnemyShooter::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ {
+ Pawn::damage(damage, healthdamage, shielddamage, originator);
+ if (getGame() && orxonox_cast<InvaderShip*>(originator) != NULL && getHealth() <= 0)
+ getGame()->addPoints(3*42);
+ }
+}
\ No newline at end of file
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemyShooter.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemyShooter.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderEnemyShooter.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,58 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderEnemyShooter.h
+ @brief Declaration of the InvaderEnemyShooter class.
+*/
+
+#ifndef _InvaderEnemyShooter_H__
+#define _InvaderEnemyShooter_H__
+
+#include "invader/InvaderPrereqs.h"
+
+#include "invader/InvaderEnemy.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _InvaderExport InvaderEnemyShooter : public InvaderEnemy
+ {
+ public:
+ InvaderEnemyShooter(Context* context);
+
+ virtual void tick(float dt);
+ virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator);
+ protected:
+ void shoot();
+ Timer shootTimer;
+
+ };
+}
+
+#endif /* _InvaderEnemyShooter_H__ */
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderHUDinfo.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderHUDinfo.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderHUDinfo.cc 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,137 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ *
+ */
+
+#include "InvaderHUDinfo.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Convert.h"
+// #include "Invader.h"
+
+namespace orxonox
+{
+ RegisterClass(InvaderHUDinfo);
+
+ InvaderHUDinfo::InvaderHUDinfo(Context* context) : OverlayText(context)
+ {
+ RegisterObject(InvaderHUDinfo);
+
+ this->InvaderGame = 0;
+ this->bShowLives_ = false;
+ this->bShowLevel_ = false;
+ this->bShowPoints_ = false;
+ this->bShowMultiplier_ = false;
+ }
+
+ void InvaderHUDinfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(InvaderHUDinfo, XMLPort, xmlelement, mode);
+
+ XMLPortParam(InvaderHUDinfo, "showlives", setShowLives, getShowLives, xmlelement, mode).defaultValues(false);
+ XMLPortParam(InvaderHUDinfo, "showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false);
+ XMLPortParam(InvaderHUDinfo, "showLevel", setShowLevel, getShowLevel, xmlelement, mode).defaultValues(false);
+ XMLPortParam(InvaderHUDinfo, "showMultiplier", setShowMultiplier, getShowMultiplier, xmlelement, mode).defaultValues(false);
+ }
+
+ void InvaderHUDinfo::tick(float dt)
+ {
+ SUPER(InvaderHUDinfo, tick, dt);
+
+ if (this->InvaderGame)
+ {
+ if (this->bShowLives_)
+ {
+ const std::string& lives = multi_cast<std::string>(this->InvaderGame->getLives());
+ this->setCaption(lives);
+ }
+ else if(this->bShowLevel_)
+ {
+ const std::string& Level = multi_cast<std::string>(this->InvaderGame->getLevel());
+ if (this->InvaderGame->lives <= 0)
+ {
+ setPosition(Vector2(0.1, 0.65));
+ this->setCaption("Game ends in 30 seconds.\nPress (e)xit / (q)uit to go to the main menu.\nTo restart fly out of the screen!");
+ setTextSize(0.05);
+ this->InvaderGame->bEndGame = true;
+ }
+ else if (this->InvaderGame->bShowLevel)
+ {
+ setTextSize(0.1);
+ setPosition(Vector2(0.3, 0.55));
+ std::stringstream sstm;
+ sstm << "Level " << Level;
+ this->setCaption(sstm.str()); // + level
+ }
+ else
+ {
+ setTextSize(0.04);
+ setPosition(Vector2(0.14, 0.055));
+ this->setCaption(Level);
+ }
+ }
+ else if(this->bShowPoints_)
+ {
+ const std::string& points = multi_cast<std::string>(this->InvaderGame->getPoints());
+ if (this->InvaderGame->lives <= 0)
+ {
+ setTextSize(0.2);
+ setPosition(Vector2(0.1, 0.25));
+ this->setCaption("Final score:\n" + points);
+ this->setColour(ColourValue(1, 0, 0, 1));
+ }
+ else
+ {
+ setTextSize(0.04);
+ setPosition(Vector2(0.14, 0.1));
+ this->setColour(ColourValue(1, 1, 1, 1));
+ this->setCaption(points);
+ }
+ }
+ else if(this->bShowMultiplier_)
+ {
+ int mult = this->InvaderGame->getMultiplier();
+ const std::string& Multiplier = "X " + multi_cast<std::string>(mult);
+ this->setCaption(Multiplier);
+ this->setColour(ColourValue(1, 0, 0, clamp(float(mult * 0.1), 0.0f, 1.0f)));
+ this->setTextSize(clamp(float(mult * 0.1), 0.0f, 1.0f) * 0.01f + 0.04f);
+ }
+ }
+ }
+
+ void InvaderHUDinfo::changedOwner()
+ {
+ SUPER(InvaderHUDinfo, changedOwner);
+
+ if (this->getOwner() && this->getOwner()->getGametype())
+ {
+ this->InvaderGame = orxonox_cast<Invader*>(this->getOwner()->getGametype().get());
+ }
+ else
+ {
+ this->InvaderGame = 0;
+ }
+ }
+}
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderHUDinfo.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderHUDinfo.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderHUDinfo.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,75 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ *
+ */
+
+#ifndef _InvaderHUDinfo_H__
+#define _InvaderHUDinfo_H__
+
+#include "invader/InvaderPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+ class _InvaderExport InvaderHUDinfo : public OverlayText, public Tickable
+ {
+ public:
+ InvaderHUDinfo(Context* context);
+
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void changedOwner();
+
+ inline void setShowLives(bool value)
+ { this->bShowLives_ = value; }
+ inline bool getShowLives() const
+ { return this->bShowLives_; }
+
+ inline void setShowLevel(bool value)
+ { this->bShowLevel_ = value; }
+ inline bool getShowLevel() const
+ { return this->bShowLevel_; }
+
+ inline void setShowPoints(bool value)
+ { this->bShowPoints_ = value; }
+ inline bool getShowPoints() const
+ { return this->bShowPoints_; }
+
+ inline void setShowMultiplier(bool value)
+ { this->bShowMultiplier_ = value; }
+ inline bool getShowMultiplier() const
+ { return this->bShowMultiplier_; }
+
+
+ private:
+ Invader* InvaderGame;
+ bool bShowLives_;
+ bool bShowLevel_;
+ bool bShowPoints_;
+ bool bShowMultiplier_;
+ };
+}
+#endif /* _InvaderHUDinfo_H__ */
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderPrereqs.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderPrereqs.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderPrereqs.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,80 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the Invader module
+*/
+
+#ifndef _InvaderPrereqs_H__
+#define _InvaderPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(INVADER_STATIC_BUILD)
+# ifdef INVADER_SHARED_BUILD
+# define _InvaderExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _InvaderExport
+# else
+# define _InvaderExport __declspec(dllimport)
+# endif
+# endif
+# define _InvaderPrivate
+#elif defined (ORXONOX_GCC_VISIBILITY)
+# define _InvaderExport __attribute__ ((visibility("default")))
+# define _InvaderPrivate __attribute__ ((visibility("hidden")))
+#else
+# define _InvaderExport
+# define _InvaderPrivate
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class Invader;
+ class InvaderCenterPoint;
+ class InvaderShip;
+ class InvaderEnemy;
+ class InvaderEnemyShooter;
+ class InvaderWeapon;
+ class InvaderWeaponEnemy;
+ class InvaderHUDinfo;
+}
+
+#endif /* _InvaderPrereqs_H__ */
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderShip.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderShip.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderShip.cc 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,188 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderShip.cc
+ @brief Implementation of the InvaderShip class.
+*/
+
+#include "InvaderShip.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "Invader.h"
+
+namespace orxonox
+{
+ RegisterClass(InvaderShip);
+
+ InvaderShip::InvaderShip(Context* context) : SpaceShip(context)
+ {
+ RegisterObject(InvaderShip);
+
+ speed = 500;
+ isFireing = false;
+ damping = 10;
+ }
+
+ void InvaderShip::tick(float dt)
+ {
+ Vector3 pos = getPosition();
+
+ //Movement calculation
+ lastTimeFront += dt * damping;
+ lastTimeLeft += dt * damping;
+ lastTime += dt;
+
+ velocity.x = interpolate(clamp(lastTimeLeft, 0.0f, 1.0f), desiredVelocity.x, 0.0f);
+ velocity.y = interpolate(clamp(lastTimeFront, 0.0f, 1.0f), desiredVelocity.y, 0.0f);
+
+ //Execute movement
+ if (this->hasLocalController())
+ {
+ float dist_y = velocity.y * dt;
+ float dist_x = velocity.x * dt;
+ if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6)
+ posforeward += dist_y;
+ else
+ {
+ velocity.y = 0;
+ // restart if game ended
+ if (getGame())
+ if (getGame()->bEndGame)
+ {
+ getGame()->start();
+ return;
+ }
+ }
+ if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3)
+ velocity.x = 0;
+ pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;
+ }
+
+ // shoot!
+ if (isFireing)
+ ControllableEntity::fire(0);
+
+ // Camera
+ WeakPtr<Camera> camera = this->getCamera();
+ if (camera != NULL)
+ {
+ camera->setPosition(Vector3(-pos.z, -posforeward, 0));
+ camera->setOrientation(Vector3::UNIT_Z, Degree(90));
+ }
+
+
+
+ // bring back on track!
+ if(pos.y != 0)
+ pos.y = 0;
+
+ setPosition(pos);
+ setOrientation(Vector3::UNIT_Y, Degree(270));
+
+ // Level up!
+ if (pos.x > 42000)
+ {
+ updateLevel();
+ setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0)
+ }
+
+ SUPER(InvaderShip, tick, dt);
+ }
+
+ void InvaderShip::updateLevel()
+ {
+ lastTime = 0;
+ if (getGame())
+ getGame()->levelUp();
+ }
+
+ void InvaderShip::moveFrontBack(const Vector2& value)
+ {
+ lastTimeLeft = 0;
+ desiredVelocity.x = -value.x * speed;
+ }
+
+ void InvaderShip::moveRightLeft(const Vector2& value)
+ {
+ lastTimeFront = 0;
+ desiredVelocity.y = value.y * speed * 42;
+ }
+ void InvaderShip::boost(bool bBoost)
+ {
+ isFireing = bBoost;
+ }
+ inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ {
+ // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
+ WeakPtr<InvaderEnemy> enemy = orxonox_cast<InvaderEnemy*>(otherObject);
+ WeakPtr<Projectile> shot = orxonox_cast<Projectile*>(otherObject);
+ // ensure that this gets only called once per enemy.
+ if (enemy != NULL && lastEnemy != enemy)
+ {
+ lastEnemy = enemy;
+
+ removeHealth(20);
+ if (getGame())
+ {
+ getGame()->multiplier = 1;
+ }
+ }
+ // was shot, decrease multiplier
+ else if (shot != NULL && lastShot != shot)
+ {
+ if (getGame() && orxonox_cast<InvaderEnemy*>(shot->getShooter()) != NULL)
+ {
+ if (getGame()->multiplier > 1)
+ {
+ lastShot = shot;
+ getGame()->multiplier -= 1;
+ }
+ }
+ }
+ return false;
+ // SUPER(InvaderShip, collidesAgainst, otherObject, contactPoint);
+ }
+
+ WeakPtr<Invader> InvaderShip::getGame()
+ {
+ if (game == NULL)
+ {
+ for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)
+ game = *it;
+ }
+ return game;
+ }
+
+ void InvaderShip::death()
+ {
+ getGame()->costLife();
+ SpaceShip::death();
+ }
+}
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderShip.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderShip.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderShip.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,90 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderShip.h
+ @brief Declaration of the InvaderShip class.
+*/
+
+#ifndef _InvaderShip_H__
+#define _InvaderShip_H__
+
+#include "invader/InvaderPrereqs.h"
+
+#include "worldentities/pawns/SpaceShip.h"
+#include "graphics/Camera.h"
+#include "weapons/projectiles/Projectile.h"
+
+namespace orxonox
+{
+ class _InvaderExport InvaderShip : public SpaceShip
+ {
+ public:
+ InvaderShip(Context* context);
+
+ virtual void tick(float dt);
+
+ // overwrite for 2d movement
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+
+ // Starts or stops fireing
+ virtual void boost(bool bBoost);
+
+ //no rotation!
+ virtual void rotateYaw(const Vector2& value){};
+ virtual void rotatePitch(const Vector2& value){};
+ //return to main menu if game has ended.
+ virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
+
+ virtual void updateLevel();
+
+ virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+
+ protected:
+ virtual void death();
+ private:
+ WeakPtr<Invader> getGame();
+ WeakPtr<Invader> game;
+ Camera* camera;
+ bool isFireing;
+ float speed, damping, posforeward;
+ float lastTimeFront, lastTimeLeft, lastTime;
+ struct Velocity
+ {
+ float x;
+ float y;
+ } velocity, desiredVelocity;
+
+ WeakPtr<InvaderEnemy> lastEnemy;
+ WeakPtr<Projectile> lastShot;
+
+ };
+}
+
+#endif /* _InvaderShip_H__ */
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeapon.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeapon.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeapon.cc 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,88 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * --
+ *
+ */
+
+/**
+ @file InvaderWeapon.h
+ @brief Implementation of the InvaderWeapon class.
+*/
+
+#include "InvaderWeapon.h"
+
+#include "core/CoreIncludes.h"
+// #include "core/XMLPort.h"
+// #include "core/command/Executor.h"
+
+#include "graphics/Model.h"
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/WeaponSystem.h"
+#include "worldentities/WorldEntity.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include "weapons/projectiles/Projectile.h"
+#include "weapons/MuzzleFlash.h"
+
+namespace orxonox
+{
+ RegisterClass(InvaderWeapon);
+
+ InvaderWeapon::InvaderWeapon(Context* context) : HsW01(context)
+ {
+ RegisterObject(InvaderWeapon);
+ }
+
+ InvaderWeapon::~InvaderWeapon(){}
+
+ void InvaderWeapon::shot()
+ {
+ assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
+
+ // Create the projectile.projectile
+ projectile = new Projectile(this->getContext());
+ WeakPtr<Model> model = new Model(projectile->getContext());
+ model->setMeshSource(mesh_);
+ model->setCastShadows(false);
+ projectile->attach(model);
+ model->setScale(5);
+
+ this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
+ // only shoot in foreward direction
+ projectile->setOrientation(Quaternion(sqrt(0.5f),0,sqrt(0.5f),0));
+ projectile->setPosition(this->getMuzzlePosition());
+ // only shoot in foreward direction
+ projectile->setVelocity(Vector3(1, 0, 0) * 2000);
+
+ projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+ projectile->setShieldDamage(this->getShieldDamage());
+ projectile->setHealthDamage(this->getHealthDamage());
+
+ // Display the muzzle flash.
+ this->InvaderWeapon::muzzleflash();
+ }
+}
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeapon.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeapon.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeapon.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,55 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderWeapon.h
+ @brief Definition of the InvaderWeapon class.
+*/
+
+#ifndef _InvaderWeapon_H__
+#define _InvaderWeapon_H__
+
+#include "weapons/weaponmodes/HsW01.h"
+#include "weapons/WeaponsPrereqs.h"
+
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _InvaderExport InvaderWeapon : public HsW01
+ {
+ public:
+ InvaderWeapon(Context* context);
+ virtual ~InvaderWeapon();
+ protected:
+ virtual void shot();
+ WeakPtr<Projectile> projectile;
+ };
+}
+
+#endif /* _InvaderWeapon_H__ */
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeaponEnemy.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeaponEnemy.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeaponEnemy.cc 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,55 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * --
+ *
+ */
+
+/**
+ @file InvaderWeaponEnemy.h
+ @brief Implementation of the InvaderWeaponEnemy class.
+*/
+
+#include "InvaderWeaponEnemy.h"
+
+namespace orxonox
+{
+ RegisterClass(InvaderWeaponEnemy);
+
+ InvaderWeaponEnemy::InvaderWeaponEnemy(Context* context) : InvaderWeapon(context)
+ {
+ RegisterObject(InvaderWeaponEnemy);
+ }
+
+ void InvaderWeaponEnemy::shot()
+ {
+ InvaderWeapon::shot();
+ // SUPER(InvaderWeaponEnemy, shot);
+ // only shoot in foreward direction
+ projectile->setVelocity(Vector3(1, 0, 0) * 300);
+ // projectile->setOrientation(Quaternion(sqrt(0.5),0,sqrt(0.5),0));
+ }
+}
+
+
Added: code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeaponEnemy.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeaponEnemy.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/InvaderWeaponEnemy.h 2014-11-05 12:15:55 UTC (rev 10107)
@@ -0,0 +1,53 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvaderWeaponEnemy.h
+ @brief Definition of the InvaderWeaponEnemy class.
+*/
+
+#ifndef _InvaderWeaponEnemy_H__
+#define _InvaderWeaponEnemy_H__
+
+// #include "weapons/weaponmodes/HsW01.h"
+// #include "weapons/WeaponsPrereqs.h"
+#include "invader/InvaderWeapon.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _InvaderExport InvaderWeaponEnemy : public InvaderWeapon
+ {
+ public:
+ InvaderWeaponEnemy(Context* context);
+ protected:
+ virtual void shot();
+ };
+}
+
+#endif /* _InvaderWeaponEnemy_H__ */
More information about the Orxonox-commit
mailing list