- Timestamp:
- Dec 11, 2017, 4:06:44 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DStone.cc
r11637 r11660 20 20 * 21 21 * Author: 22 * Samuel Riedel22 * Viviane Yang 23 23 * Co-authors: 24 24 * ... … … 26 26 */ 27 27 28 29 28 30 /** 29 31 @file Asteroids2DStone.cc 32 30 33 @brief Implementation of the Asteroids2DStone class. 31 */ 34 35 TO DO: 36 - instead of moving over the boarders of the playing field, modify the tick function so that the stones bounce back 37 - when to split? It does not work if you override kill() function...->damage() function? 38 */ 32 39 33 40 #include "Asteroids2DStone.h" … … 87 94 Vector3 pos = this->getPosition(); 88 95 96 89 97 if(pos.x >= width/2){ 90 98 pos.x = -width/2; … … 103 111 inline bool Asteroids2DStone::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 104 112 { 113 orxout() << "AsteroidStone getroffen" << endl; 105 114 if(orxonox_cast<Asteroids2DShip*>(otherObject)) 106 115 { 107 this->split(); 116 orxout() << "getroffen von Ship" << endl; 117 split(); 108 118 } 109 119 return false; … … 112 122 void Asteroids2DStone::split() 113 123 { 124 orxout() << "split" << endl; 114 125 if(size == 1) 115 126 { … … 117 128 118 129 }else if(size == 2){ 130 131 132 //Templates can be found in data/levels/templates/asteroidsAsteroids2D.oxt 119 133 Asteroids2DStone* newStone1 = new Asteroids2DStone(this->getContext(), 1, this->getPosition()); 120 134 newStone1->addTemplate("stone1"); 121 135 Asteroids2DStone* newStone2 = new Asteroids2DStone(this->getContext(), 1, this->getPosition()); 122 136 newStone2->addTemplate("stone1"); 137 123 138 }else{ 124 139 Asteroids2DStone* newStone1 = new Asteroids2DStone(this->getContext(), 2, this->getPosition()); … … 129 144 } 130 145 131 132 133 134 //Overload kill function to generate 2 asteriods135 /*void Asteroids2DStone::kill()136 {137 this->damage(this->health)138 if(this->size < 1)139 {140 this->death();141 }else{142 size -= 1;143 144 }145 146 147 }*/148 149 150 146 }
Note: See TracChangeset
for help on using the changeset viewer.