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;
}
void
BadGuy::kill_fall()
{
- hitpoints--;
- if (hitpoints <= 0) {
+ bullet_hitpoints--;
+ if (bullet_hitpoints <= 0) {
SoundManager::get()->play_sound(IDToSound(SND_FALL), this,
Sector::current()->player->get_pos());
physic.set_velocity_y(0);
* variable might have been changed so that it faces towards the player.
*/
virtual void activate();
- /** caleed when the badguy has been deactivated */
+ /** called when the badguy has been deactivated */
virtual void deactivate();
void kill_squished(Player& player);
Direction dir;
int hitpoints;
+ int bullet_hitpoints;
private:
void try_activate();
#define SHOOT_TIME 0.4
#define JUMP_TIME 0.5
#define INITIAL_HITPOINTS 3
+#define INITIAL_BULLET_HP 10
static const float WALKSPEED = 90;
Nolok_01::activate()
{
hitpoints = INITIAL_HITPOINTS;
+ bullet_hitpoints = INITIAL_BULLET_HP;
physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED);
sprite->set_action(dir == LEFT ? "left" : "right");
action = WALKING;
bool result = false;
player.bounce(*this);
if (hitpoints <= 0) {
+ bullet_hitpoints = 0;
sprite->set_action("dead");
kill_squished(player);
Sector::current()->add_object(new Door((int)get_pos().x+32, 512, "sector1", "main2"));
void
Nolok_01::kill_fall()
{
- hitpoints--;
- if (hitpoints <= 0) {
+ bullet_hitpoints--;
+ if (bullet_hitpoints <= 0) {
SoundManager::get()->play_sound(IDToSound(SND_FALL), this,
Sector::current()->player->get_pos());
physic.set_velocity_y(0);
static const float ANGRY_JUMP_WAIT = .5;
static const float STUN_TIME = 2;
static const int INITIAL_HITPOINTS = 3;
+static const int INITIAL_BULLET_HP = 10;
Yeti::Yeti(const lisp::Lisp& reader)
{
state = INIT;
side = LEFT;
hitpoints = INITIAL_HITPOINTS;
+ bullet_hitpoints = INITIAL_BULLET_HP;
sound_gna = SoundManager::get()->load_sound(
get_resource_filename("sounds/yeti_gna.wav"));
sound_roar = SoundManager::get()->load_sound(
//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;
}
Yeti::kill_fall()
{
SoundManager::get()->play_sound(sound_roar);
- hitpoints--;
- if (hitpoints <= 0) {
+ bullet_hitpoints--;
+ if (bullet_hitpoints <= 0) {
SoundManager::get()->play_sound(IDToSound(SND_FALL), this,
Sector::current()->player->get_pos());
physic.set_velocity_y(0);