BadGuy::BadGuy()
: sprite(0), dir(LEFT), state(STATE_INIT)
{
- //TODO: Count fireball hits separately so you can make badguys need more fireballs than jumps
+ //Set hitpoints and bullet hitpoints
hitpoints = 1;
+ bullet_hitpoints = 1;
}
BadGuy::~BadGuy()
//TODO: fix inaccuracy (tux sometimes dies even if badguy was hit)
// give badguys some invincible time (prevent them from being hit multiple times)
hitpoints--;
+ bullet_hitpoints--;
if(collision_squished(player))
return ABORT_MOVE;
else if (hitpoints <= 0) {
+ bullet_hitpoints = 0;
player.kill(Player::SHRINK);
return FORCE_MOVE;
}
}
+ std::cout << "COLLISION - HITPOINTS: " << hitpoints << ", BULLET HP: " << bullet_hitpoints << std::endl;
player.kill(Player::SHRINK);
return FORCE_MOVE;
}
void
BadGuy::kill_fall()
{
- hitpoints--;
- if (hitpoints <= 0) {
+ bullet_hitpoints--;
+ if (bullet_hitpoints <= 0) {
+ hitpoints = 0;
SoundManager::get()->play_sound(IDToSound(SND_FALL), this,
Sector::current()->player->get_pos());
physic.set_velocity_y(0);
physic.enable_gravity(true);
set_state(STATE_FALLING);
}
+ std::cout << "KILL_FALL - HITPOINTS: " << hitpoints << ", BULLET HP: " << bullet_hitpoints << std::endl;
}
void