From: florianf Date: Sat, 6 Mar 2010 19:51:15 +0000 (+0000) Subject: Owl: Drop "Bombfishes" by default. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e333331bb9f2e04c2291aae9787854ed060fee5b;p=supertux.git Owl: Drop "Bombfishes" by default. The position where the carried object is being held has been improved. The Owl has been moved one layer up (to "LAYER_OBJECTS + 1") so it is in front of the objects it holds. git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6566 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/data/levels/test/owl.stl b/data/levels/test/owl.stl index da47c913e..9ecf4d422 100644 --- a/data/levels/test/owl.stl +++ b/data/levels/test/owl.stl @@ -17,11 +17,12 @@ (owl (x 1312) (y 832) - (carry "trampoline") + (carry "bombfish") ) (owl (x 2400) (y 896) + (carry "trampoline") ) (spawnpoint (name "main") diff --git a/src/badguy/owl.cpp b/src/badguy/owl.cpp index a110b23c6..011a52792 100644 --- a/src/badguy/owl.cpp +++ b/src/badguy/owl.cpp @@ -20,6 +20,7 @@ #include "sprite/sprite.hpp" #include "supertux/object_factory.hpp" #include "supertux/sector.hpp" +#include "object/anchor_point.hpp" #include "object/player.hpp" #include "object/rock.hpp" #include "util/reader.hpp" @@ -29,8 +30,8 @@ #define ACTIVATION_DISTANCE 128.0 Owl::Owl(const Reader& reader) : - BadGuy(reader, "images/creatures/owl/owl.sprite"), - carried_obj_name("rock"), + BadGuy(reader, "images/creatures/owl/owl.sprite", LAYER_OBJECTS + 1), + carried_obj_name("bombfish"), carried_object(NULL) { reader.get("carry", carried_obj_name); @@ -38,8 +39,8 @@ Owl::Owl(const Reader& reader) : } Owl::Owl(const Vector& pos, Direction d) : - BadGuy(pos, d, "images/creatures/owl/owl.sprite"), - carried_obj_name("rock"), + BadGuy(pos, d, "images/creatures/owl/owl.sprite", LAYER_OBJECTS + 1), + carried_obj_name("bombfish"), carried_object(NULL) { set_action (dir == LEFT ? "left" : "right", /* loops = */ -1); @@ -99,9 +100,10 @@ Owl::active_update (float elapsed_time) if (carried_object != NULL) { if (!is_above_player ()) { - Vector obj_pos = get_pos (); + Vector obj_pos = get_anchor_pos (bbox, ANCHOR_BOTTOM); + obj_pos.x -= 16.0; /* FIXME: Actually do use the half width of the carried object here. */ + obj_pos.y += 3.0; /* Move a little away from the hitbox (the body). Looks nicer. */ - obj_pos.y += bbox.get_height (); carried_object->grab (*this, obj_pos, dir); } else { /* if (is_above_player) */