X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy%2Fskullyhop.cpp;h=63e6435de30b90f315876c8e2185cc5ad3eeae5b;hb=d84d73b701cc7fa2bd74f3490b9be1bf8b6f705a;hp=302ac9aea13543a2c5b006e0f5af466e179af1ed;hpb=32bbcd2699cdbc533f9bb95c7679182b4eef2767;p=supertux.git diff --git a/src/badguy/skullyhop.cpp b/src/badguy/skullyhop.cpp index 302ac9aea..63e6435de 100644 --- a/src/badguy/skullyhop.cpp +++ b/src/badguy/skullyhop.cpp @@ -27,16 +27,19 @@ namespace { const float HORIZONTAL_SPEED = 220; /**< x-speed when jumping */ const float MIN_RECOVER_TIME = 0.1; /**< minimum time to stand still before starting a (new) jump */ const float MAX_RECOVER_TIME = 1.0; /**< maximum time to stand still before starting a (new) jump */ + static const std::string HOP_SOUND = "sounds/hop.ogg"; } SkullyHop::SkullyHop(const lisp::Lisp& reader) : BadGuy(reader, "images/creatures/skullyhop/skullyhop.sprite") { + sound_manager->preload( HOP_SOUND ); } SkullyHop::SkullyHop(const Vector& pos, Direction d) : BadGuy(pos, d, "images/creatures/skullyhop/skullyhop.sprite") { + sound_manager->preload( HOP_SOUND ); } void @@ -74,6 +77,7 @@ SkullyHop::set_state(SkullyHopState newState) sprite->set_action(dir == LEFT ? "jumping-left" : "jumping-right"); physic.set_velocity_x(dir == LEFT ? -HORIZONTAL_SPEED : HORIZONTAL_SPEED); physic.set_velocity_y(VERTICAL_SPEED); + sound_manager->play( HOP_SOUND, get_pos()); } state = newState;