Changeset 11503
- Timestamp:
- Oct 23, 2017, 3:19:08 PM (7 years ago)
- Location:
- code/branches/FlappyOrx_HS17
- Files:
-
- 12 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw
r11481 r11503 7 7 8 8 <?lua 9 include("overlays/FlappyHUD.oxo") 9 include("stats.oxo") 10 include("templates/lodInformation.oxt") 11 ?> 12 13 <?lua 14 include("templates/spaceshipAssff2.oxt") 15 include("templates/spaceshipPirate.oxt") 16 include("templates/spaceshipFlappyOrx.oxt") 17 include("templates/enemyFlappyOrx.oxt") 18 include("overlays/FlappyOrxHUD.oxo") 10 19 ?> 11 20 12 21 <Level 22 plugins = flappyorx 23 gametype = FlappyOrx 13 24 > 14 <Scene 15 ambientlight = "0.8, 0.7, 0.4" 16 skybox = "Orxonox/skyBoxBasic" 17 25 <templates> 26 <Template link=lodtemplate_default /> 27 </templates> 28 <?lua include("includes/notifications.oxi") ?> 18 29 19 <WorldAmbientSound 20 source="Earth.ogg" 21 looping="true" 22 playOnLoad="true" 23 /> 30 <!-- ambientlight = "0.8, 0.8, 0.8" 31 skybox = "Orxonox/Starbox" --> 32 <Scene 33 ambientlight = "0.8, 0.7, 0.4" 34 skybox = "Orxonox/skyBoxBasic" 35 > 24 36 25 <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" /> 26 <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0"/> 37 <WorldAmbientSound 38 source="Earth.ogg" 39 looping="true" 40 playOnLoad="true" 41 /> 27 42 28 29 </Scene> 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="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" /> 45 <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=FlappyOrxShip pawndesign=spaceshipFlappyOrx /> 46 47 48 <FlappyOrxCenterPoint name=flappyorxcenter /> 49 50 51 52 </Scene> 30 53 </Level> 54 -
code/branches/FlappyOrx_HS17/data/levels/Invaders.oxw
r10624 r11503 5 5 screenshot = "orxonoxArcade.png" 6 6 /> 7 7 8 <?lua 8 9 include("stats.oxo") -
code/branches/FlappyOrx_HS17/src/modules/CMakeLists.txt
r11451 r11503 46 46 ADD_SUBDIRECTORY(hover) 47 47 ADD_SUBDIRECTORY(superorxobros) 48 ADD_SUBDIRECTORY(flappyorx) -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
r11481 r11503 29 29 /** 30 30 @file FlappyOrx.cc 31 @brief Implementation of the FlappyOrx class. 31 32 */ 32 33 34 #include "FlappyOrx.h" 35 #include "Highscore.h" 36 #include "core/CoreIncludes.h" 37 #include "core/EventIncludes.h" 38 #include "core/command/Executor.h" 39 #include "core/config/ConfigValueIncludes.h" 40 41 #include "gamestates/GSLevel.h" 42 #include "chat/ChatManager.h" 43 44 // ! HACK 45 #include "infos/PlayerInfo.h" 46 47 #include "FlappyOrxCenterPoint.h" 48 #include "FlappyOrxShip.h" 49 50 #include "core/command/ConsoleCommand.h" 51 #include "worldentities/ExplosionPart.h" 33 52 34 53 namespace orxonox … … 39 58 { 40 59 RegisterObject(FlappyOrx); 41 this->setHUDTemplate("FlappyHUD"); 60 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 61 this->center_ = nullptr; 62 bEndGame = false; 63 lives = 3; 64 level = 1; 65 point = 0; 66 bShowLevel = false; 67 multiplier = 1; 68 b_combo = false; 69 70 this->setHUDTemplate("FlappyOrxHUD"); 71 } 72 73 void FlappyOrx::levelUp() 74 { 75 level++; 76 if (getPlayer() != nullptr) 77 { 78 for (int i = 0; i < 7; i++) 79 { 80 81 WeakPtr<ExplosionPart> chunk5 = new ExplosionPart(this->center_->getContext()); 82 chunk5->setPosition(this->center_->getPosition()); 83 chunk5->setVelocity(Vector3(1000, 0, 0)); //player->getVelocity() 84 chunk5->setScale(10); 85 chunk5->setEffect1("Orxonox/explosion2b"); 86 chunk5->setEffect2("Orxonox/smoke6"); 87 chunk5->setMinSpeed(0); 88 chunk5->setMaxSpeed(0); 89 chunk5->Explode(); 90 91 } 92 } 93 addPoints(multiplier * 42); 94 multiplier *= 2; 95 toggleShowLevel(); 96 showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&FlappyOrx::toggleShowLevel, this))); 97 } 98 99 FlappyOrxShip* FlappyOrx::getPlayer() 100 { 101 if (player == nullptr) 102 { 103 for (FlappyOrxShip* ship : ObjectList<FlappyOrxShip>()) 104 player = ship; 105 } 106 return player; 107 } 108 109 110 void FlappyOrx::setCenterpoint(FlappyOrxCenterPoint* center) 111 { 112 this->center_ = center; 113 } 114 115 void FlappyOrx::costLife() 116 { 117 lives--; 118 multiplier = 1; 119 // end the game in 30 seconds. 120 if (lives <= 0) 121 enemySpawnTimer.setTimer(30.0f, false, createExecutor(createFunctor(&FlappyOrx::end, this))); 122 }; 123 124 void FlappyOrx::comboControll() 125 { 126 if (b_combo) 127 multiplier++; 128 // if no combo was performed before, reset multiplier 129 else 130 multiplier = 1; 131 b_combo = false; 42 132 } 43 133 44 134 void FlappyOrx::start() 45 135 { 136 // Set variable to temporarily force the player to spawn. 137 this->bForceSpawn_ = true; 138 139 if (this->center_ == nullptr) // abandon mission! 140 { 141 orxout(internal_error) << "FlappyOrx: No Centerpoint specified." << endl; 142 GSLevel::startMainMenu(); 143 return; 144 } 145 // Call start for the parent class. 46 146 Deathmatch::start(); 147 } 148 void FlappyOrx::addPoints(int numPoints) 149 { 150 if (!bEndGame) 151 { 152 point += numPoints * multiplier; 153 b_combo = true; 154 } 47 155 } 48 156 … … 53 161 // It will misteriously crash the game! 54 162 // Instead startMainMenu, this won't crash. 163 if (Highscore::exists()){ 164 int score = this->getPoints(); 165 if(score > Highscore::getInstance().getHighestScoreOfGame("Orxonox Arcade")) 166 Highscore::getInstance().storeHighscore("Orxonox Arcade",score); 167 168 } 55 169 GSLevel::startMainMenu(); 56 170 } -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
r11481 r11503 36 36 #define _FlappyOrx_H__ 37 37 38 #include "flappyorx/FlappyOrxPrereqs.h" 39 38 40 #include "gametypes/Deathmatch.h" 41 #include "tools/Timer.h" 39 42 40 43 namespace orxonox … … 48 51 virtual void start() override; 49 52 virtual void end() override; 50 53 virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command 54 55 void spawnEnemy(); 56 57 void setCenterpoint(FlappyOrxCenterPoint* center); 58 59 int getLives(){return this->lives;} 60 int getLevel(){return this->level;} 61 int getPoints(){return this->point;} 62 int getMultiplier(){return this->multiplier;} 63 64 void costLife(); 65 void levelUp(); 66 void addPoints(int numPoints); 67 // checks if multiplier should be reset. 68 void comboControll(); 69 int lives; 70 int multiplier; 71 bool bEndGame; 72 bool bShowLevel; 51 73 private: 52 74 void toggleShowLevel(){bShowLevel = !bShowLevel;} 75 FlappyOrxShip* getPlayer(); 76 WeakPtr<FlappyOrxCenterPoint> center_; 77 WeakPtr<FlappyOrxShip> player; 78 79 Timer enemySpawnTimer; 80 Timer comboTimer; 81 Timer showLevelTimer; 82 //Context* context; 83 int level; 84 int point; 85 bool b_combo; 53 86 }; 54 87 }
Note: See TracChangeset
for help on using the changeset viewer.