Skip to content

Commit

Permalink
A few fixes to skydive's animation code
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusGuy committed Jan 8, 2024
1 parent 50743fb commit 37cddf2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/badguy/owl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Owl::initialize()
}
else
{
carried_object->grab(*this, get_pos(), m_dir);
Sector::get().add_object(std::move(game_object));
}
}
Expand Down
16 changes: 14 additions & 2 deletions src/badguy/skydive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SkyDive::SkyDive(const ReaderMapping& reader) :
BadGuy(reader, "images/creatures/skydive/skydive.sprite")
{
SoundManager::current()->preload("sounds/explosion.wav");
set_action("normal", 1);
set_action("normal");
}

void
Expand Down Expand Up @@ -113,7 +113,7 @@ SkyDive::ungrab(MovingObject& object, Direction dir_)
}
else if (!m_frozen)
{
set_action("falling", 1);
set_action("falling");
m_physic.set_velocity_y(0);
m_physic.set_acceleration_y(0);
}
Expand Down Expand Up @@ -164,6 +164,18 @@ SkyDive::collision_tile(uint32_t tile_attributes)
}
}

void
SkyDive::initialize()
{
if (!m_owner)
{
set_action("falling");
m_physic.set_velocity_y(0);
m_physic.set_acceleration_y(0);
}
BadGuy::initialize();
}

void
SkyDive::kill_fall()
{
Expand Down
1 change: 1 addition & 0 deletions src/badguy/skydive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SkyDive final : public BadGuy
virtual void collision_solid(const CollisionHit& hit) override;
virtual HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit) override;
virtual void collision_tile(uint32_t tile_attributes) override;
virtual void initialize() override;

/* Inherited from Portable */
virtual void grab(MovingObject& object, const Vector& pos, Direction dir) override;
Expand Down

0 comments on commit 37cddf2

Please sign in to comment.