X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy%2Ffish.cpp;h=93898d476823c8ea8fc21e97971bd5febc0464aa;hb=7a6f00e27bdc0aac2107506c3b00cbf0bf1cccc5;hp=b60312509934627ae45ef9e143ec72cf4b5b519f;hpb=a113d3bd1feddd510e3b2852b0d42522735eee40;p=supertux.git diff --git a/src/badguy/fish.cpp b/src/badguy/fish.cpp index b60312509..93898d476 100644 --- a/src/badguy/fish.cpp +++ b/src/badguy/fish.cpp @@ -91,7 +91,8 @@ Fish::collision_tile(uint32_t tile_attributes) // stop when we have reached the stop position if (get_pos().y >= stop_y) { - start_waiting(); + if(!frozen) + start_waiting(); movement = Vector(0, 0); } @@ -109,7 +110,8 @@ Fish::active_update(float elapsed_time) } // set sprite - sprite->set_action(physic.get_velocity_y() < 0 ? "normal" : "down"); + if(!frozen) + sprite->set_action(physic.get_velocity_y() < 0 ? "normal" : "down"); // we can't afford flying out of the tilemap, 'cause the engine would remove us. if ((get_pos().y - 31.8) < 0) // too high, let us fall @@ -123,7 +125,7 @@ void Fish::start_waiting() { waiting.start(FISH_WAIT_TIME); - set_group(COLGROUP_DISABLED); + set_colgroup_active(COLGROUP_DISABLED); physic.enable_gravity(false); physic.set_velocity_y(0); } @@ -133,7 +135,28 @@ Fish::jump() { physic.set_velocity_y(FISH_JUMP_POWER); physic.enable_gravity(true); - set_group(COLGROUP_MOVING); + set_colgroup_active(COLGROUP_MOVING); +} + +void +Fish::freeze() +{ + BadGuy::freeze(); + sprite->set_action(physic.get_velocity_y() < 0 ? "iced" : "iced-down"); + waiting.stop(); +} + +void +Fish::unfreeze() +{ // does this happen at all? (or do fishes die when they fall frozen?) + BadGuy::unfreeze(); + start_waiting(); +} + +bool +Fish::is_freezable() const +{ + return true; } IMPLEMENT_FACTORY(Fish, "fish")