Inimigo morre se tu atira
[Projeto-PCG.git] / enemy.cpp
blob2cd27e9af27a819239233d09d218691288744f6a
1 #include "enemy.h"
2 #include "shot.h"
4 Enemy::Enemy(Game* agame): Shooter(agame, Ponto(0,0), Ponto(0,0)) {
5 dead = false;
8 void Enemy::die() {
9 if (dead) return;
10 dead = true;
11 game->enemyManager->remove(this);
12 game->gravityManager->deleteThing(this);
13 game->collisionManager->remove(this);
16 void Enemy::think() {
17 if (dead) return;
20 void Enemy::collide(Thing* b) {
21 if (dead) return;
22 Shot* shot = dynamic_cast<Shot*>(b);
23 if (shot && shot->firedBy != this) {
24 this->die();