Skip to content

Commit

Permalink
Owl: Drop "Bombfishes" by default.
Browse files Browse the repository at this point in the history
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.

SVN-Revision: 6566
  • Loading branch information
Florian Forster committed Mar 6, 2010
1 parent 35f17b8 commit 69ad367
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion data/levels/test/owl.stl
Expand Up @@ -17,11 +17,12 @@
(owl
(x 1312)
(y 832)
(carry "trampoline")
(carry "bombfish")
)
(owl
(x 2400)
(y 896)
(carry "trampoline")
)
(spawnpoint
(name "main")
Expand Down
14 changes: 8 additions & 6 deletions src/badguy/owl.cpp
Expand Up @@ -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"
Expand All @@ -29,17 +30,17 @@
#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);
set_action (dir == LEFT ? "left" : "right", /* loops = */ -1);
}

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);
Expand Down Expand Up @@ -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) */
Expand Down

0 comments on commit 69ad367

Please sign in to comment.