/* $Id: weaponhelicopter.cpp,v 1.2 2005/10/16 17:53:05 pohlt Exp $ */ #include "weaponhelicopter.hpp" #include "world.hpp" #include "avatar.hpp" #include "stationarygun.hpp" /**********************************************************/ bool WeaponHelicopter::reallyShoot( World* world, Avatar* avatar, const StationaryGun* gun ) const { if( gun ) { // helicopter is not supported to be shot by a gun CHECK( false, "WeaponHelicopter::reallyShoot: no support " "for gun mode\n" ); return false; } else { // create helicopter Helicopter* const helicopter = dynamic_cast( world->newObject(HELICOPTER) ); // place helicopter return helicopter->initialize( // initial position of the missile avatar->placeBesideCollRect( helicopter->getCollRectX() + helicopter->getCollRectWidth() - 1, -helicopter->getCollRectX(), helicopter->getCollRectY() + helicopter->getCollRectHeight() - 1, -helicopter->getCollRectY() ), // initial velocity avatar->getRandomizedAimingVector(2)*1.0 + avatar->getVel(), // owner avatar->getPlayer()->getPlayerID() ); } } /**********************************************************/