X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbadguy%2Figel.cpp;h=1fc48c0c749b466c3c7db1ac54967f414ae9cd77;hb=b88dc6c0a778a019bf0b1f28c2cc9d624d9bbdbd;hp=41c3543d5fb11c00fce2711aff346204007a7e3f;hpb=729bc6717bf68314dc9fad25db3a9f728062263e;p=supertux.git diff --git a/src/badguy/igel.cpp b/src/badguy/igel.cpp index 41c3543d5..1fc48c0c7 100644 --- a/src/badguy/igel.cpp +++ b/src/badguy/igel.cpp @@ -22,17 +22,17 @@ namespace { -const float WALKSPEED = 80; /**< speed at which we walk around */ +const float IGEL_SPEED = 80; /**< speed at which we walk around */ const float TURN_RECOVER_TIME = 0.5; /**< seconds before we will again turn around when shot at */ const float RANGE_OF_VISION = 256; /**< range in px at which we can see bullets */ } // namespace Igel::Igel(const Reader& reader) : - WalkingBadguy(reader, "images/creatures/igel/igel.sprite", "walking-left", "walking-right"), + WalkingBadguy(reader, "images/creatures/igel/igel.sprite", "walking-left", "walking-right"), turn_recover_timer() { - walk_speed = WALKSPEED; + walk_speed = IGEL_SPEED; max_drop_height = 16; } @@ -40,7 +40,7 @@ Igel::Igel(const Vector& pos, Direction d) : WalkingBadguy(pos, d, "images/creatures/igel/igel.sprite", "walking-left", "walking-right"), turn_recover_timer() { - walk_speed = WALKSPEED; + walk_speed = IGEL_SPEED; max_drop_height = 16; } @@ -60,8 +60,8 @@ Igel::turn_around() bool Igel::can_see(const MovingObject& o) { - Rect mb = get_bbox(); - Rect ob = o.get_bbox(); + Rectf mb = get_bbox(); + Rectf ob = o.get_bbox(); bool inReach_left = ((ob.p2.x < mb.p1.x) && (ob.p2.x >= mb.p1.x-((dir == LEFT) ? RANGE_OF_VISION : 0))); bool inReach_right = ((ob.p1.x > mb.p2.x) && (ob.p1.x <= mb.p2.x+((dir == RIGHT) ? RANGE_OF_VISION : 0))); @@ -99,8 +99,9 @@ Igel::active_update(float elapsed_time) HitResponse Igel::collision_bullet(Bullet& bullet, const CollisionHit& hit) { - // default reaction if hit on front side - if (((dir == LEFT) && hit.left) || ((dir == RIGHT) && hit.right)) { + // default reaction if hit on front side or for freeze and unfreeze + if (((dir == LEFT) && hit.left) || ((dir == RIGHT) && hit.right) || + (bullet.get_type() == ICE_BONUS) || ((bullet.get_type() == FIRE_BONUS) && (frozen))) { return BadGuy::collision_bullet(bullet, hit); } @@ -110,6 +111,12 @@ Igel::collision_bullet(Bullet& bullet, const CollisionHit& hit) } bool +Igel::is_freezable() const +{ + return true; +} + +bool Igel::collision_squished(GameObject& ) { // this will hurt