Changeset 11608 for code/branches/Asteroid_HS17
- Timestamp:
- Nov 27, 2017, 5:00:59 PM (7 years ago)
- Location:
- code/branches/Asteroid_HS17
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/data/levels/Asteroids2D.oxw
r11593 r11608 6 6 /> 7 7 8 9 <!--wird immer gebraucht-->10 8 <?lua 11 9 include("stats.oxo") … … 13 11 ?> 14 12 15 16 13 <?lua 17 include ("overlays/HUDTemplates3.oxo") 14 include("templates/spaceshipAssff2.oxt") 15 include("templates/spaceshipPirate.oxt") 18 16 include("templates/spaceshipAsteroids2D.oxt") 17 include("templates/enemyInvader.oxt") 18 include("overlays/Asteroids2DHUD.oxo") 19 19 ?> 20 20 21 <!--Templates schreiben oder von spaceship kopieren-->22 23 21 <Level 24 plugin = asteroids2D22 plugins = asteroids2D 25 23 gametype = Asteroids2D 26 24 > … … 30 28 <?lua include("includes/notifications.oxi") ?> 31 29 32 <!-- ambientlight = "0.8, 0.8, 0.8"33 skybox = "Orxonox/Starbox"34 WorldRange lieber im src einschraenken-->35 30 <Scene 36 ambientlight = "0.8, 0.7, 0.4" 37 skybox = "Orxonox/skyBoxBasic" 31 ambientlight = "1.0, 1.0, 1.0" 32 skybox = "Orxonox/Starbox" 33 negativeWorldRange = "-100000, -100000, -100000" 34 positiveWorldRange = " 100000, 100000, 100000" 38 35 > 36 37 <WorldAmbientSound 38 source="Earth.ogg" 39 looping="true" 40 playOnLoad="true" 41 /> 42 43 <!-- <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"/> --> 44 <Light type=directional position="-100, 10000, -700" lookat="0.2, -1, 0" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> 45 <SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass= Asteroids2DShip pawndesign=spaceshipasteroids2d /> 46 47 <Model mesh="axes.mesh" scale=10 position="0,0,0" /> 48 <Asteroids2DCenterPoint name=asteroids2Dcenter /> 39 49 40 <!-- <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"/> -->41 <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" />42 43 <SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=Asteroids2DShip pawndesign=spaceshipasteroids2D/>44 45 <Asteroids2DCenterPoint name=asteroids2Dcenter />46 47 <Model mesh="axes.mesh" scale=10 position="0,0,-100" />48 49 50 50 51 </Scene> 51 52 </Level> 52 53 -
code/branches/Asteroid_HS17/data/levels/MiniGameTest.oxw
r11593 r11608 15 15 include("templates/spaceshipMiniGameTest.oxt") 16 16 include("templates/enemyInvader.oxt") 17 include("templates/DodgeRacePattern.oxt") 18 include("overlays/DodgeRaceHUD.oxo") 17 include("overlays/MiniGameTestHUD.oxo") 19 18 ?> 20 19 … … 30 29 <Scene 31 30 ambientlight = "1.0, 1.0, 1.0" 32 skybox = "Orxonox/ skyBoxClouds"31 skybox = "Orxonox/Starbox" 33 32 negativeWorldRange = "-100000, -100000, -100000" 34 33 positiveWorldRange = " 100000, 100000, 100000" … … 43 42 <!-- <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"/> --> 44 43 <Light type=directional position="-100, 10000, -700" lookat="0.2, -1, 0" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> 45 <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass= MiniGameTestShip pawndesign=spaceshipdodgerace /> 44 <SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass= MiniGameTestShip pawndesign=spaceshipminigametest /> 45 46 <Model mesh="axes.mesh" scale=10 position="0,0,0" /> 46 47 47 48 <DistanceTrigger name="start" position="-200,0,0" target="Pawn" distance=10 stayActive="true" delay=0 /> … … 50 51 <MiniGameTestCenterPoint name=invadercenter /> 51 52 52 <StaticEntity position="0,-50,0" direction="0,0,0" scale="1" collisionType=static mass=1 friction=0.01 >53 <attached>54 <Model position="0,0,0" mesh="plane.mesh" scale3D="100000,0,100000" />55 </attached>56 53 57 <collisionShapes>58 <BoxCollisionShape position="0,0,0" halfExtents="1,1,1" />59 </collisionShapes>60 61 </StaticEntity>62 54 63 55 -
code/branches/Asteroid_HS17/data/levels/templates/spaceshipAsteroids2D.oxt
r11593 r11608 1 <Template name=spaceshipasteroids2 D>2 < SpaceShip1 <Template name=spaceshipasteroids2d> 2 <Asteroids2DShip 3 3 hudtemplate = spaceshiphud 4 4 camerapositiontemplate = spaceshipescortcameras 5 5 spawnparticlesource = "Orxonox/fairytwirl" 6 6 spawnparticleduration = 3 7 explosionchunks = 107 explosionchunks = 4 8 8 9 health = 8010 maxhealth = 20011 initialhealth = 809 health = 40 10 maxhealth = 40 11 initialhealth = 40 12 12 13 shieldhealth = 3514 initialshieldhealth = 3515 maxshieldhealth = 6016 shieldabsorption = 0. 913 shieldhealth = 20 14 initialshieldhealth = 20 15 maxshieldhealth = 20 16 shieldabsorption = 0.1 17 17 shieldrechargerate = 1 18 18 shieldrechargewaittime = 1 … … 34 34 35 35 collisionType = "dynamic" 36 mass = 8037 linearDamping = 0. 736 mass = 4200000 37 linearDamping = 0.9999999 38 38 angularDamping = 0.9999999 39 40 collisiondamage = 100 41 enablecollisiondamage = true 42 39 43 > 40 44 <engines> 41 <MultiStateEngine position=" 7.6, 0, 6" template=spaceship escortengine />42 <MultiStateEngine position="-7.6, 0, 0" template=spaceship escortengine />45 <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipinvaderengine /> 46 <MultiStateEngine position="-7.6, 0, 0" template=spaceshipinvaderengine /> 43 47 </engines> 44 48 <attached> … … 56 60 <BoxCollisionShape position="0, 0,-12" halfExtents="4 , 4 ,7" /> 57 61 </collisionShapes> 58 <explosion >62 <explosion > 59 63 <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_flash2" effect2="orxonox/explosion_flame2" /> 60 64 <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_shockwave2" effect2="orxonox/explosion_sparks2" /> 61 65 <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_streak2" effect2="orxonox/explosion_afterglow" /> 62 66 63 <ExplosionPart mesh="explosionparts/escort_part_1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 64 <ExplosionPart mesh="explosionparts/escort_part_2.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 65 <ExplosionPart mesh="explosionparts/escort_part_3.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 66 <ExplosionPart mesh="explosionparts/escort_part_4.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 67 <ExplosionPart mesh="explosionparts/escort_part_5.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 68 <ExplosionPart mesh="explosionparts/escort_part_6.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 67 <ExplosionPart minspeed=0 maxspeed=0 effect1="Orxonox/explosion2b" effect2="Orxonox/smoke6" /> 68 <ExplosionPart mesh="CockpitDebris.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 69 <ExplosionPart mesh="BodyDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 70 <ExplosionPart mesh="WingDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 71 <ExplosionPart mesh="WingDebris2.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" /> 69 72 </explosion> 70 73 <?lua 71 include("../includes/ weaponSettingsEscort.oxi")74 include("../includes/invaderWeapon.oxi") 72 75 ?> 73 </ SpaceShip>76 </Asteroids2DShip> 74 77 </Template> 75 78 76 79 <Template name=spaceshipescortcameras defaults=0> 77 < SpaceShip>80 <Asteroids2DShip> 78 81 <camerapositions> 79 <CameraPosition position="0,600,0" pitch=-90 absolute=true /> 80 <CameraPosition position="0,50,160" drag=true mouselook=false /> 81 <CameraPosition position="0,40,125" drag=true mouselook=false/> 82 <CameraPosition position="0,30, 90" drag=true mouselook=false/> 82 <!--<CameraPosition position="0,100,180" direction="0, -0.2, -1" drag=false mouselook=true /> 83 <CameraPosition position="0,200,250" direction="0, -0.4, -1" drag=false mouselook=true /> 84 <CameraPosition position="0,30,150" direction="0, 0, -1" drag=false mouselook=true /> 85 <CameraPosition position="0,1300,-100" direction="0, -1, 0" drag=false mouselook=true /> 86 --> 87 <CameraPosition position="0,600,0" pitch=-90 absolute=true /> 88 <CameraPosition position="0,50,160" drag=true mouselook=true /> 89 <CameraPosition position="0,40,125" drag=true mouselook=true /> 90 <CameraPosition position="0,30, 90" drag=true mouselook=true /> 83 91 </camerapositions> 84 </ SpaceShip>92 </Asteroids2DShip> 85 93 </Template> 86 94 87 <Template name=spaceship escortengine baseclass=MultiStateEngine>95 <Template name=spaceshipinvaderengine baseclass=MultiStateEngine> 88 96 <MultiStateEngine 89 97 boostfactor = 2.2 … … 105 113 <EffectContainer condition="idle"> 106 114 <WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" looping=1 active=false/> 107 />108 <Backlight mainstate=activity active=false scale=0.33 name=bltest position=" 12, -2, 14" colour="0.2, 0.5, 0.65, 1.0" width=150 length=15 lifetime=2 elements=1 trailmaterial="Trail/backlighttrail" turnontime=2 turnofftime=1 material="Flares/ThrusterFlare1" />109 <Backlight mainstate=activity active=false scale=0.33 name=bltest position="-12, -2, 14" colour="0.2, 0.5, 0.65, 1.0" width=15 length=15 lifetime=2 elements=1 trailmaterial="Trail/backlighttrail" turnontime=2 turnofftime=1 material="Flares/ThrusterFlare1" />110 115 </EffectContainer> 111 116 <EffectContainer condition="not idle"> … … 117 122 </EffectContainer> 118 123 <EffectContainer condition="normal or boost"> 119 <Backlight mainstate=activity active=false scale=0.33 name=bltest position=" 12, -2, 14" colour="0.2, 1.0, 0.65, 1.0" width=5 length=1500 lifetime=2 elements=1trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />120 <Backlight mainstate=activity active=false scale=0.33 name=bltest position="-12, -2, 14" colour="0.2, 1.0, 0.65, 1.0" width=15 length=1500 lifetime=2 elements=1trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />124 <Backlight mainstate=activity active=false scale=0.33 name=bltest position=" 12, 0, 10" colour="0.2, 1.0, 0.65, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" /> 125 <Backlight mainstate=activity active=false scale=0.33 name=bltest position="-12, 0, 10" colour="0.2, 1.0, 0.65, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" /> 121 126 </EffectContainer> 122 123 127 <EffectContainer condition="boost"> 124 128 <Backlight mainstate=activity active=false scale=0.33 name=bltest position=" 12, 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" /> -
code/branches/Asteroid_HS17/data/levels/templates/spaceshipMiniGameTest.oxt
r11593 r11608 1 <Template name=spaceship dodgerace>1 <Template name=spaceshipminigametest> 2 2 <MiniGameTestShip 3 3 hudtemplate = spaceshiphud … … 80 80 <MiniGameTestShip> 81 81 <camerapositions> 82 <CameraPosition position="0,100,180" direction="0, -0.2, -1" drag=false mouselook=true /> 83 <CameraPosition position="0,200,250" direction="0, -0.4, -1" drag=false mouselook=true /> 84 <CameraPosition position="0,30,150" direction="0, 0, -1" drag=false mouselook=true /> 85 <CameraPosition position="0,1300,-100" direction="0, -1, 0" drag=false mouselook=true /> 82 <!--<CameraPosition position="0,100,180" direction="0, -0.2, -1" drag=false mouselook=true /> 83 <CameraPosition position="0,200,250" direction="0, -0.4, -1" drag=false mouselook=true /> 84 <CameraPosition position="0,30,150" direction="0, 0, -1" drag=false mouselook=true /> 85 <CameraPosition position="0,1300,-100" direction="0, -1, 0" drag=false mouselook=true /> 86 --> 87 <CameraPosition position="0,600,0" pitch=-90 absolute=true /> 88 <CameraPosition position="0,50,160" drag=true mouselook=true /> 89 <CameraPosition position="0,40,125" drag=true mouselook=true /> 90 <CameraPosition position="0,30, 90" drag=true mouselook=true /> 86 91 </camerapositions> 87 92 </MiniGameTestShip> -
code/branches/Asteroid_HS17/src/modules/CMakeLists.txt
r11593 r11608 47 47 ADD_SUBDIRECTORY(superorxobros) 48 48 ADD_SUBDIRECTORY(minigametest) 49 ADD_SUBDIRECTORY(asteroids2D) -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc
r11593 r11608 35 35 #include "Asteroids2DShip.h" // Necessary for getPlayer function. Do NOT include this in Header! 36 36 #include "core/CoreIncludes.h" 37 37 #include "Highscore.h" 38 38 39 39 namespace orxonox … … 44 44 { 45 45 RegisterObject(Asteroids2D); 46 this->bEndGame = false;47 46 47 bEndGame = false; 48 lives = 1; 49 level = 1; 50 point = 0; 51 bShowLevel = false; 52 multiplier = 1; 53 b_combo = false; 54 counter = 5000; 55 pattern = 1; 56 lastPosition = 0; 57 // spawn enemy every 3.5 seconds 58 //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Asteroids2D::spawnEnemy, this))); 59 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 60 this->center_ = nullptr; 61 this->setHUDTemplate("Asteroids2DHUD"); 62 } 63 64 void Asteroids2D::levelUp() 65 { 66 level++; 67 if (getPlayer() != nullptr) 68 { 69 for (int i = 0; i < 7; i++) 70 { 71 WeakPtr<ExplosionPart> chunk5 = new ExplosionPart(this->center_->getContext()); 72 chunk5->setPosition(Vector3(600, 0, 100.f * i - 300)); 73 chunk5->setVelocity(Vector3(1000, 0, 0)); //player->getVelocity() 74 chunk5->setScale(10); 75 chunk5->setEffect1("Orxonox/explosion2b"); 76 chunk5->setEffect2("Orxonox/smoke6"); 77 chunk5->Explode(); 78 79 } 80 } 81 addPoints(multiplier * 42); 82 multiplier *= 2; 83 toggleShowLevel(); 84 showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&Asteroids2D::toggleShowLevel, this))); 48 85 } 49 86 50 87 void Asteroids2D::tick(float dt) 51 88 { 52 89 53 90 SUPER(Asteroids2D, tick, dt); 54 91 } … … 66 103 } 67 104 105 void Asteroids2D::costLife() 106 { 107 //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&Asteroids2D::end, this))); 108 lives = 0; 109 }; 110 68 111 void Asteroids2D::start() 69 112 { 70 113 orxout() << "start" << endl; 71 114 72 115 // Set variable to temporarily force the player to spawn. 73 116 this->bForceSpawn_ = false; … … 83 126 } 84 127 128 void Asteroids2D::playerPreSpawn(PlayerInfo* player) 129 { 130 if(lives <= 0) 131 { 132 this->end(); 133 } 134 } 135 136 void Asteroids2D::addPoints(int numPoints) 137 { 138 if (!bEndGame) 139 { 140 point += numPoints * multiplier; 141 b_combo = true; 142 } 143 } 144 85 145 void Asteroids2D::end() 86 146 { … … 89 149 // It will misteriously crash the game! 90 150 // Instead startMainMenu, this won't crash. 91 orxout() << "Asteroids2D Game has ended" << endl; 151 if (Highscore::exists()){ 152 int score = this->getPoints(); 153 if(score > Highscore::getInstance().getHighestScoreOfGame("Dodge Race")) 154 Highscore::getInstance().storeHighscore("Dodge Race",score); 155 156 } 92 157 GSLevel::startMainMenu(); 93 158 } -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h
r11593 r11608 50 50 #include "gamestates/GSLevel.h" 51 51 #include "chat/ChatManager.h" 52 52 #include <vector> 53 53 54 54 // ! HACK … … 58 58 59 59 #include "gametypes/Deathmatch.h" 60 #include "tools/Timer.h" 60 61 61 62 namespace orxonox … … 69 70 virtual void start() override; 70 71 virtual void end() override; 72 71 73 virtual void tick(float dt) override; 74 75 virtual void playerPreSpawn(PlayerInfo* player) override; 76 77 void levelUp(); 78 79 int getLives(){return this->lives;} 80 int getLevel(){return this->level;} 81 int getPoints(){return this->point;} 82 int getMultiplier(){return this->multiplier;} 72 83 73 84 void setCenterpoint(Asteroids2DCenterPoint* center) 74 85 { this->center_ = center; } 86 virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command 75 87 76 virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command 88 // checks if multiplier should be reset. 89 void costLife(); 90 77 91 bool bEndGame; 92 bool bShowLevel; 93 int lives; 94 int multiplier; 95 float counter; 96 int pattern; 97 float currentPosition; 98 float lastPosition; 78 99 79 100 private: 80 101 Timer endGameTimer; 81 102 82 103 Asteroids2DShip* getPlayer(); 83 104 WeakPtr<Asteroids2DShip> player; 105 std::vector<Asteroids2DCube*> cubeList; 106 void toggleShowLevel(){bShowLevel = !bShowLevel;} 107 void addPoints(int numPoints); 108 84 109 WeakPtr<Asteroids2DCenterPoint> center_; 110 int level; 111 int point; 112 bool b_combo; 113 114 Timer enemySpawnTimer; 115 Timer comboTimer; 116 Timer showLevelTimer; 85 117 86 118 -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DCenterPoint.cc
r11593 r11608 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/XMLPort.h" 37 38 38 39 #include "Asteroids2D.h" … … 47 48 48 49 this->checkGametype(); 50 this->width_ = 200; 51 this->height_ = 120; 49 52 } 53 /** 54 @brief 55 Method to create a Asteroids2DCenterpoint through XML. 56 */ 57 void Asteroids2DCenterPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 58 { 59 SUPER(Asteroids2DCenterPoint, XMLPort, xmlelement, mode); 50 60 61 XMLPortParam(Asteroids2DCenterPoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode); 62 } 51 63 void Asteroids2DCenterPoint::checkGametype() 52 64 { -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DCenterPoint.h
r11593 r11608 49 49 public: 50 50 Asteroids2DCenterPoint(Context* context); //checks whether the gametype is actually Asteroids2D. 51 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a PongCenterpoint through XML. 52 /** 53 @brief Set the dimensions of the playing field. 54 @param dimension A vector with the width of the playing field as first component and the height as second. 55 */ 56 void setFieldDimension(const Vector2& dimension) 57 { this->width_ = dimension.x; this->height_ = dimension.y; } 58 /** 59 @brief Get the dimensions of the playing field. 60 @return Returns a vector with the width of the playing field as first component and the height as second. 61 */ 62 Vector2 getFieldDimension() const 63 { return Vector2(this->width_, this->height_); } 51 64 52 65 private: 53 66 void checkGametype(); 67 float width_, height_; 54 68 55 69 }; -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.cc
r11593 r11608 25 25 */ 26 26 27 #include " DodgeRaceHUDinfo.h"27 #include "Asteroids2DHUDinfo.h" 28 28 29 29 #include "core/CoreIncludes.h" 30 30 #include "core/XMLPort.h" 31 31 #include "util/Convert.h" 32 //#include " DodgeRace.h"32 //#include "Asteroids2D.h" 33 33 34 34 namespace orxonox 35 35 { 36 RegisterClass( DodgeRaceHUDinfo);36 RegisterClass(Asteroids2DHUDinfo); 37 37 38 DodgeRaceHUDinfo::DodgeRaceHUDinfo(Context* context) : OverlayText(context)38 Asteroids2DHUDinfo::Asteroids2DHUDinfo(Context* context) : OverlayText(context) 39 39 { 40 RegisterObject( DodgeRaceHUDinfo);40 RegisterObject(Asteroids2DHUDinfo); 41 41 42 this-> DodgeRaceGame = nullptr;42 this->Asteroids2DGame = nullptr; 43 43 this->bShowPoints_ = true; 44 44 } 45 45 46 void DodgeRaceHUDinfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)46 void Asteroids2DHUDinfo::XMLPort(Element& xmlelement, XMLPort::Mode mode) 47 47 { 48 SUPER( DodgeRaceHUDinfo, XMLPort, xmlelement, mode);48 SUPER(Asteroids2DHUDinfo, XMLPort, xmlelement, mode); 49 49 50 XMLPortParam( DodgeRaceHUDinfo,"showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false);50 XMLPortParam(Asteroids2DHUDinfo,"showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false); 51 51 } 52 52 53 void DodgeRaceHUDinfo::tick(float dt)53 void Asteroids2DHUDinfo::tick(float dt) 54 54 { 55 SUPER( DodgeRaceHUDinfo, tick, dt);55 SUPER(Asteroids2DHUDinfo, tick, dt); 56 56 57 57 58 58 if(this->bShowPoints_) 59 59 { 60 const std::string& points = multi_cast<std::string>(this-> DodgeRaceGame->getPoints());61 if (this-> DodgeRaceGame->lives <= 0)60 const std::string& points = multi_cast<std::string>(this->Asteroids2DGame->getPoints()); 61 if (this->Asteroids2DGame->lives <= 0) 62 62 { 63 63 setTextSize(0.2); … … 76 76 } 77 77 78 void DodgeRaceHUDinfo::changedOwner()78 void Asteroids2DHUDinfo::changedOwner() 79 79 { 80 SUPER( DodgeRaceHUDinfo, changedOwner);80 SUPER(Asteroids2DHUDinfo, changedOwner); 81 81 82 82 if (this->getOwner() && this->getOwner()->getGametype()) 83 83 { 84 this-> DodgeRaceGame = orxonox_cast<DodgeRace*>(this->getOwner()->getGametype());84 this->Asteroids2DGame = orxonox_cast<Asteroids2D*>(this->getOwner()->getGametype()); 85 85 } 86 86 else 87 87 { 88 this-> DodgeRaceGame = nullptr;88 this->Asteroids2DGame = nullptr; 89 89 } 90 90 } -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc
r11593 r11608 55 55 void Asteroids2DShip::tick(float dt) 56 56 { 57 Vector3 pos = getPosition();58 59 //Movement calculation60 lastTimeFront += dt * damping;61 lastTimeLeft += dt * damping;62 lastTime += dt;63 64 velocity.x = interpolate(clamp(lastTimeLeft, 0.0f, 1.0f), desiredVelocity.x, 0.0f);65 velocity.y = interpolate(clamp(lastTimeFront, 0.0f, 1.0f), desiredVelocity.y, 0.0f);66 67 //Execute movement68 if (this->hasLocalController())69 {70 float dist_y = velocity.y * dt;71 //float dist_x = velocity.x * dt;72 if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6)73 posforeward += dist_y;74 else75 {76 velocity.y = 0;77 // restart if game ended78 /*79 if (getGame())80 if (getGame()->bEndGame)81 {82 getGame()->start();83 return;84 }*/85 }86 87 pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;88 }89 90 // bring back on track!91 if(pos.y != 0)92 {93 pos.y = 0;94 }95 96 setPosition(pos);97 setOrientation(Vector3::UNIT_Y, Degree(270));98 99 57 SUPER(Asteroids2DShip, tick, dt); 100 58 } 101 59 102 void Asteroids2DShip::moveFrontBack(const Vector2& value) 60 void Asteroids2DShip::updateLevel() 61 { 62 lastTime = 0; 63 if (getGame()) 64 getGame()->levelUp(); 65 } 66 67 /* void Asteroids2DShip::moveFrontBack(const Vector2& value) 103 68 { 104 69 //lastTimeFront = 0; 105 70 //desiredVelocity.y = value.y * speed * 42; 106 71 orxout() << "FrontBack" << endl; 72 SUPER(Asteroids2DShip, moveFrontBack, value); 107 73 } 108 74 109 75 void Asteroids2DShip::moveRightLeft(const Vector2& value) 110 76 { 111 lastTimeLeft = 0; 112 desiredVelocity.x = value.x * speed; 77 //lastTimeLeft = 0; 78 //desiredVelocity.x = value.x * speed; 79 orxout() << "RightLeft" << endl; 80 SUPER(Asteroids2DShip, moveFrontBack, value); 113 81 } 82 */ 114 83 void Asteroids2DShip::boost(bool bBoost) 115 84 { … … 139 108 void Asteroids2DShip::death() 140 109 { 141 //getGame()->costLife();110 getGame()->costLife(); 142 111 SpaceShip::death(); 143 112 } -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h
r11593 r11608 55 55 56 56 // overwrite for 2d movement 57 virtual void moveFrontBack(const Vector2& value) override;58 virtual void moveRightLeft(const Vector2& value) override;57 //virtual void moveFrontBack(const Vector2& value) override; 58 //virtual void moveRightLeft(const Vector2& value) override; 59 59 60 60 // Starts or stops fireing … … 62 62 63 63 //no rotation! 64 virtual void rotateYaw(const Vector2& value) override{}; 64 65 virtual void rotatePitch(const Vector2& value) override{}; 65 66 66 67 //return to main menu if game has ended. 67 68 virtual void rotateRoll(const Vector2& value) override{if (getGame()) if (getGame()->bEndGame) getGame()->end();}; 69 70 virtual void updateLevel(); 68 71 69 72 virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; -
code/branches/Asteroid_HS17/src/modules/asteroids2D/CMakeLists.txt
r11593 r11608 1 SET_SOURCE_FILES( Asteroids2D_SRC_FILES1 SET_SOURCE_FILES(MINIGAMESTEST_SRC_FILES 2 2 Asteroids2D.cc 3 3 Asteroids2DCenterPoint.cc 4 4 Asteroids2DShip.cc 5 Asteroids2DCube.cc 6 Asteroids2DHUDinfo.cc 5 7 ) 6 8 … … 11 13 orxonox 12 14 overlays 13 SOURCE_FILES ${ ASTEROIDS2D_SRC_FILES}15 SOURCE_FILES ${MINIGAMESTEST_SRC_FILES} 14 16 ) -
code/branches/Asteroid_HS17/src/modules/minigametest/MiniGameTest.cc
r11593 r11608 34 34 #include "MiniGameTest.h" 35 35 #include "MiniGameTestShip.h" // Necessary for getPlayer function. Do NOT include this in Header! 36 #include "MiniGameTestCube.h"37 36 #include "core/CoreIncludes.h" 38 37 #include "Highscore.h" … … 58 57 // spawn enemy every 3.5 seconds 59 58 //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&MiniGameTest::spawnEnemy, this))); 60 comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&MiniGameTest::comboControll, this)));61 59 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 62 60 this->center_ = nullptr; 63 64 61 this->setHUDTemplate("MiniGameTestHUD"); 65 62 } … … 90 87 void MiniGameTest::tick(float dt) 91 88 { 92 if (getPlayer() != nullptr) 93 { 94 currentPosition = getPlayer()->getWorldPosition().x; 95 counter = counter + (currentPosition - lastPosition); 96 lastPosition = currentPosition; 97 point = (int) currentPosition; 98 getPlayer()->speed = 830.0f - (point / 1000); 99 100 for(unsigned int i=0; i < cubeList.size();i++) 101 { 102 if(cubeList.at(i)->getPosition().x < currentPosition-3000) 103 { 104 cubeList.at(i)->destroy(); 105 cubeList.erase(cubeList.begin()+i); 106 } 107 } 108 109 if(counter >= 3000) 110 { 111 counter = 0; 112 for(int i = 0; i<6; i++) 113 { 114 MiniGameTestCube* cube = new MiniGameTestCube(this->center_->getContext()); 115 cubeList.push_back(cube); 116 switch(pattern) 117 { 118 case 1: cube->addTemplate("MiniGameTestCube01"); 119 break; 120 case 2: cube->addTemplate("MiniGameTestCube02"); 121 break; 122 123 } 124 125 cube->setPosition(getPlayer()->getWorldPosition() + Vector3(5000.0f, 0.0f, -3600.0f + (i*1200))); 126 //stEntity->setScale3D(50,50,50); 127 } 128 129 130 pattern %= 2; 131 pattern ++; 132 133 } 134 135 } 89 136 90 SUPER(MiniGameTest, tick, dt); 137 91 } … … 155 109 }; 156 110 157 void MiniGameTest::comboControll()158 {159 if (b_combo)160 multiplier++;161 // if no combo was performed before, reset multiplier162 else163 multiplier = 1;164 b_combo = false;165 }166 167 111 void MiniGameTest::start() 168 112 { 169 113 orxout() << "start" << endl; 170 for(unsigned int i=0; i< cubeList.size();i++)171 {172 cubeList.at(i)->destroy();173 cubeList.erase(cubeList.begin()+i);174 114 175 }176 cubeList.clear();177 115 // Set variable to temporarily force the player to spawn. 178 116 this->bForceSpawn_ = false; … … 194 132 this->end(); 195 133 } 196 197 // Reset all the cubes198 /*199 orxout() << "prespawn" << endl;200 for(int i=0; i< cubeList.size();i++)201 {202 cubeList.at(i)->destroy();203 cubeList.erase(cubeList.begin()+i);204 }205 cubeList.clear();206 lives = 1;207 point = 0;208 lastPosition = 0;209 */210 134 } 211 135 -
code/branches/Asteroid_HS17/src/modules/minigametest/MiniGameTest.h
r11593 r11608 87 87 88 88 // checks if multiplier should be reset. 89 void comboControll();90 89 void costLife(); 91 90 -
code/branches/Asteroid_HS17/src/modules/minigametest/MiniGameTestShip.cc
r11593 r11608 55 55 void MiniGameTestShip::tick(float dt) 56 56 { 57 Vector3 pos = getPosition();58 59 //Movement calculation60 lastTimeFront += dt * damping;61 lastTimeLeft += dt * damping;62 lastTime += dt;63 64 velocity.x = interpolate(clamp(lastTimeLeft, 0.0f, 1.0f), desiredVelocity.x, 0.0f);65 velocity.y = interpolate(clamp(lastTimeFront, 0.0f, 1.0f), desiredVelocity.y, 0.0f);66 67 //Execute movement68 if (this->hasLocalController())69 {70 float dist_y = velocity.y * dt;71 //float dist_x = velocity.x * dt;72 if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6)73 posforeward += dist_y;74 else75 {76 velocity.y = 0;77 // restart if game ended78 /*79 if (getGame())80 if (getGame()->bEndGame)81 {82 getGame()->start();83 return;84 }*/85 }86 87 pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;88 }89 90 91 // Camera92 Camera* camera = this->getCamera();93 if (camera != nullptr)94 {95 // camera->setPosition(Vector3(-pos.z, -posforeward, 0));96 camera->setOrientation(Vector3::UNIT_Z, Degree(0));97 }98 99 100 101 // bring back on track!102 if(pos.y != 0)103 {104 pos.y = 0;105 }106 107 setPosition(pos);108 setOrientation(Vector3::UNIT_Y, Degree(270));109 110 // Level up!111 if (pos.x > 42000)112 {113 updateLevel();114 setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0)115 }116 117 57 SUPER(MiniGameTestShip, tick, dt); 118 58 } … … 125 65 } 126 66 127 void MiniGameTestShip::moveFrontBack(const Vector2& value)67 /* void MiniGameTestShip::moveFrontBack(const Vector2& value) 128 68 { 129 69 //lastTimeFront = 0; 130 70 //desiredVelocity.y = value.y * speed * 42; 131 71 orxout() << "FrontBack" << endl; 72 SUPER(MiniGameTestShip, moveFrontBack, value); 132 73 } 133 74 134 75 void MiniGameTestShip::moveRightLeft(const Vector2& value) 135 76 { 136 lastTimeLeft = 0; 137 desiredVelocity.x = value.x * speed; 77 //lastTimeLeft = 0; 78 //desiredVelocity.x = value.x * speed; 79 orxout() << "RightLeft" << endl; 80 SUPER(MiniGameTestShip, moveFrontBack, value); 138 81 } 82 */ 139 83 void MiniGameTestShip::boost(bool bBoost) 140 84 { -
code/branches/Asteroid_HS17/src/modules/minigametest/MiniGameTestShip.h
r11593 r11608 55 55 56 56 // overwrite for 2d movement 57 virtual void moveFrontBack(const Vector2& value) override;58 virtual void moveRightLeft(const Vector2& value) override;57 //virtual void moveFrontBack(const Vector2& value) override; 58 //virtual void moveRightLeft(const Vector2& value) override; 59 59 60 60 // Starts or stops fireing … … 82 82 WeakPtr<MiniGameTest> game; 83 83 WeakPtr<WorldEntity> lastEntity; 84 Camera* camera;85 84 float lastTimeFront, lastTimeLeft, lastTime; 86 85 struct Velocity
Note: See TracChangeset
for help on using the changeset viewer.