X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy%2Fskullyhop.cpp;h=a5ba2caf04a54400c3f5cc0f35c7bf8e8f716cb8;hb=7c2f8e23f9accd00bd9ee2319da8ab8aa341c7cf;hp=9282d29ea717a30a910a7b4f7574db5c4442ca43;hpb=78e9b27b7059c9b9b16a7f871ab71f751ec75323;p=supertux.git diff --git a/src/badguy/skullyhop.cpp b/src/badguy/skullyhop.cpp index 9282d29ea..a5ba2caf0 100644 --- a/src/badguy/skullyhop.cpp +++ b/src/badguy/skullyhop.cpp @@ -23,7 +23,7 @@ #include "random_generator.hpp" namespace { - const float VERTICAL_SPEED = 450; /**< y-speed when jumping */ + const float VERTICAL_SPEED = -450; /**< y-speed when jumping */ 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 */ @@ -32,14 +32,11 @@ namespace { SkullyHop::SkullyHop(const lisp::Lisp& reader) : BadGuy(reader, "images/creatures/skullyhop/skullyhop.sprite") { - has_initial_direction = false; } SkullyHop::SkullyHop(const Vector& pos, Direction d) - : BadGuy(pos, "images/creatures/skullyhop/skullyhop.sprite") + : BadGuy(pos, d, "images/creatures/skullyhop/skullyhop.sprite") { - has_initial_direction = true; - initial_direction = d; } void @@ -54,8 +51,6 @@ SkullyHop::write(lisp::Writer& writer) void SkullyHop::activate() { - if (has_initial_direction) dir = initial_direction; - // initial state is JUMPING, because we might start airborne state = JUMPING; sprite->set_action(dir == LEFT ? "jumping-left" : "jumping-right"); @@ -99,12 +94,12 @@ SkullyHop::collision_solid(GameObject& , const CollisionHit& hit) if(state != JUMPING) return CONTINUE; // check if we hit the floor while falling - if ((hit.normal.y < 0) && (physic.get_velocity_y() < 0)) { + if ((hit.normal.y < 0) && (physic.get_velocity_y() > 0)) { set_state(STANDING); } // check if we hit the roof while climbing - if ((hit.normal.y > 0) && (physic.get_velocity_y() > 0)) { + if ((hit.normal.y > 0) && (physic.get_velocity_y() < 0)) { physic.set_velocity_y(0); }