- Timestamp:
- Feb 11, 2018, 4:49:56 PM (7 years ago)
- Location:
- code/branches/Presentation_HS17_merge/src/modules/asteroids2D
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Presentation_HS17_merge/src/modules/asteroids2D/Asteroids2D.cc
r11727 r11729 59 59 #include "Highscore.h" 60 60 #include "gamestates/GSLevel.h" 61 #include "infos/PlayerInfo.h" 61 62 62 63 namespace orxonox … … 124 125 if(this->firstTick_) 125 126 { 126 getPlayer();127 127 for(int i = 0; i < 5; ++i) 128 128 { … … 141 141 //stones are created with a size -> second constructor in Asteroids2DStone class 142 142 Asteroids2DStone* newStone = new Asteroids2DStone(this->center_->getContext()); 143 newStone->setAsteroids2DPlayer(player);144 143 145 144 //look at templates in data/levels/templates/asteroidsAsteroids2D.oxt … … 163 162 Asteroids2DShip* Asteroids2D::getPlayer() 164 163 { 165 if (player == nullptr) 166 { 167 for (Asteroids2DShip* ship : ObjectList<Asteroids2DShip>()) 168 { 169 player = ship; 170 } 171 } 172 return player; 164 for (Asteroids2DShip* ship : ObjectList<Asteroids2DShip>()) 165 { 166 return ship; 167 } 168 return nullptr; 173 169 } 174 170 … … 201 197 void Asteroids2D::playerPreSpawn(PlayerInfo* player) 202 198 { 199 this->playerInfo_ = player; 203 200 if(lives <= 0) 204 201 { … … 226 223 { 227 224 int score = this->getPoints(); 228 Highscore::getInstance().storeScore("Asteroids2D", score, this-> getPlayer()->getPlayer());225 Highscore::getInstance().storeScore("Asteroids2D", score, this->playerInfo_); 229 226 } 230 227 GSLevel::startMainMenu(); -
code/branches/Presentation_HS17_merge/src/modules/asteroids2D/Asteroids2D.h
r11727 r11729 94 94 95 95 96 WeakPtr< Asteroids2DShip> player;96 WeakPtr<PlayerInfo> playerInfo_; 97 97 void toggleShowLevel(){bShowLevel = !bShowLevel;} 98 98 -
code/branches/Presentation_HS17_merge/src/modules/asteroids2D/Asteroids2DStone.h
r11666 r11729 53 53 Vector3 randomPosition (float maxwidth, float maxheight); 54 54 Vector3 randomVelocity(float maxspeed); 55 void setAsteroids2DPlayer(Asteroids2DShip* player){this->player = player;};56 55 virtual int getSize(){ return this->size;} 57 56 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; … … 62 61 Asteroids2D* getGame(); 63 62 WeakPtr<Asteroids2D> game; 64 WeakPtr<Asteroids2DShip> player;65 63 int size; // three sizes, 3-> two 2s, 2-> two 1s, 1-> die 66 64 float width, height; //field
Note: See TracChangeset
for help on using the changeset viewer.