4 #include "shotmanager.h"
11 Shot::Shot(double x
, double y
, double angle
, double speed
, double gravity
, Weapon
* w
, int damage
) {
14 this->damage
= damage
;
17 game
->gravityManager
->subscribe(this);
18 game
->collisionManager
->subscribe(this);
19 gravityRate
= gravity
;
21 setSpeed(-cos(angle
)*speed
,sin(angle
)*speed
);
25 game
->shotManager
->deleteShot(this);
26 game
->collisionManager
->remove(this);
27 if (gravityRate
!= 0.0)
28 game
->gravityManager
->deleteThing(this);
31 void Shot::desenha() {
33 glTranslatef(getX(),getY(),0);
38 Polygon
Shot::getCollision() {
39 Polygon collisionSprite
= sprite
;
40 return collisionSprite
;
43 void Shot::collide(Thing
* b
){
45 /*Player* p = dynamic_cast<Player*>(b);
47 Enemy* e = dynamic_cast<Enemy*>(b);
48 std::cout<<b<<std::endl;
57 bool Shot::canCollide(Thing
* b
) {
58 Shooter
* shooter
= dynamic_cast<Shooter
*>(b
);