Skip to content

Commit

Permalink
move dart's sprite action initialisation to the constructor(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
Narre committed Aug 2, 2023
1 parent b1844bd commit c0d8218
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/badguy/dart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Dart::Dart(const ReaderMapping& reader) :
SoundManager::current()->preload(DART_SOUND);
SoundManager::current()->preload("sounds/darthit.wav");
SoundManager::current()->preload("sounds/stomp.wav");

set_action("flying", m_dir);
}

Dart::Dart(const Vector& pos, Direction d, const BadGuy* parent_, const std::string& sprite) :
Expand All @@ -49,6 +51,8 @@ Dart::Dart(const Vector& pos, Direction d, const BadGuy* parent_, const std::str
SoundManager::current()->preload(DART_SOUND);
SoundManager::current()->preload("sounds/darthit.wav");
SoundManager::current()->preload("sounds/stomp.wav");

set_action("flying", m_dir);
}

bool
Expand All @@ -66,7 +70,6 @@ Dart::initialize()
{
m_physic.set_velocity_x(m_dir == Direction::LEFT ? -::DART_SPEED : m_dir == Direction::RIGHT ? ::DART_SPEED : 0);
m_physic.set_velocity_y(m_dir == Direction::UP ? -::DART_SPEED : m_dir == Direction::DOWN ? ::DART_SPEED : 0);
set_action("flying", m_dir);
}

void
Expand Down

0 comments on commit c0d8218

Please sign in to comment.