/* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: * Florian Zinggeler * Co-authors: * ... * */ /** @file InvaderEnemy.h @brief Declaration of the InvaderEnemy class. */ #include "AsteroidsStone.h" #include "core/CoreIncludes.h" #include "Asteroids.h" #include "AsteroidsShip.h" #include #include "util/Math.h" namespace orxonox { RegisterClass(AsteroidsStone); //pawn kann sterben -> nach dem Tot sollen aber 2 Asteroiden spawnen AsteroidsStone::AsteroidsStone(Context* context) : Pawn(context) { RegisterObject(AsteroidsStone); maxspeed = 50.0f; //Random Spawn? pos= random? this->setPosition(rnd(0, fieldWidth_), rnd(0, fieldHeigth_), 0); if(r){ this.r = r*0.5; }else{ this.r = rnd(15, 50); } //random Geschwindigkeit und Richtung velocity.x = rnd(0, maxspeed); velocity.y = rnd(0, maxspeed); } //Bis hier geschrieben void AsteroidsStone::tick(float dt) { Vector3 pos = this->getPosition(); pos.x += velocity.x*dt; pos.y += velocity.y*dt; setPosition(pos); SUPER(AsteroidsStone, tick, dt); } inline bool AsteroidsStone::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { if(orxonox_cast(otherObject)) removeHealth(2000); return false; } }