Skip to content

Commit

Permalink
Owl releases payload when killed by fire of invincibility, fixes bug 782
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniela Ferraz authored and LMH0013 committed Jul 8, 2013
1 parent 44600a0 commit 38af569
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
29 changes: 24 additions & 5 deletions src/badguy/owl.cpp
Expand Up @@ -17,12 +17,13 @@

#include "badguy/owl.hpp"

#include "sprite/sprite.hpp"
#include "supertux/object_factory.hpp"
#include "supertux/sector.hpp"
#include "audio/sound_manager.hpp"
#include "object/anchor_point.hpp"
#include "object/player.hpp"
#include "object/rock.hpp"
#include "sprite/sprite.hpp"
#include "supertux/object_factory.hpp"
#include "supertux/sector.hpp"
#include "util/reader.hpp"
#include "util/log.hpp"

Expand Down Expand Up @@ -109,10 +110,10 @@ Owl::active_update (float elapsed_time)
carried_object->ungrab (*this, dir);
carried_object = NULL;
}
else

else
carried_object->grab (*this, obj_pos, dir);
}

else { /* if (is_above_player) */
carried_object->ungrab (*this, dir);
carried_object = NULL;
Expand All @@ -136,6 +137,24 @@ Owl::collision_squished(GameObject&)
return true;
}

void
Owl::kill_fall()
{
sound_manager->play("sounds/fall.wav", get_pos());
physic.set_velocity_y(0);
physic.set_acceleration_y(0);
physic.enable_gravity(true);
set_state(STATE_FALLING);

if (carried_object != NULL) {
carried_object->ungrab (*this, dir);
carried_object = NULL;
}

// start dead-script
run_dead_script();
}

void
Owl::collision_solid(const CollisionHit& hit)
{
Expand Down
1 change: 1 addition & 0 deletions src/badguy/owl.hpp
Expand Up @@ -29,6 +29,7 @@ class Owl : public BadGuy

void initialize();
void collision_solid(const CollisionHit& hit);
void kill_fall();

protected:
bool is_above_player (void);
Expand Down

0 comments on commit 38af569

Please sign in to comment.