- Timestamp:
- Nov 6, 2017, 4:06:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/src/modules/asteroids/AsteroidsStone.cc
r11528 r11541 39 39 #include "util/Math.h" 40 40 41 41 42 namespace orxonox 42 43 { … … 47 48 RegisterObject(AsteroidsStone); 48 49 49 50 51 50 maxspeed = 50.0f; 52 //Random Spawn? pos= random? 51 //Random Spawn? pos= random? -> spawn durch timer in der Asteroids Klasse 53 52 this->setPosition(rnd(0, fieldWidth_), rnd(0, fieldHeigth_), 0); 54 if(r){55 this.r = r*0.5;56 }else{57 this.r = rnd(15, 50);58 }59 53 60 54 //random Geschwindigkeit und Richtung 61 55 velocity.x = rnd(0, maxspeed); 62 56 velocity.y = rnd(0, maxspeed); 57 this->context = context; 63 58 } 59 60 void Asteroids::death() 61 { 62 if(this->size == 1){ 63 Pawn::death(); 64 }else if(this->size == 2){ 65 Pawn::death(); 66 67 //Wie mache ich das ? Eigentlich in der game Klasse? sonst zeigt der Pointer auf einen falschen Bereich 68 69 for(int i = 0; i<2; i++) 70 { 71 AsteroidsStone* newStone; 72 newStone = new AsteroidsStone(this->context); 73 newStone->addTemplate("asteroidsstone"); 74 newStone->setAsteroidsPlayer(player); 75 } 76 77 } 78 } 79 80 64 81 //Bis hier geschrieben 65 82 void AsteroidsStone::tick(float dt) … … 67 84 Vector3 pos = this->getPosition(); 68 85 pos.x += velocity.x*dt; 69 pos.y += velocity.y*dt; 86 pos.z += velocity.y*dt; 87 88 if(pos.y != 0){ 89 pos.y=0; 90 } 70 91 setPosition(pos); 71 92 SUPER(AsteroidsStone, tick, dt);
Note: See TracChangeset
for help on using the changeset viewer.