From: Christoph Sommer Date: Sat, 28 Oct 2006 12:09:59 +0000 (+0000) Subject: Added litte "air arrow" to show where Tux is when he's above the camera. Graphics... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9f98af91f3501e30ff59e42b8d9e056f5c8064ba;p=supertux.git Added litte "air arrow" to show where Tux is when he's above the camera. Graphics are just a placeholder. SVN-Revision: 4425 --- diff --git a/data/images/engine/hud/airarrow.png b/data/images/engine/hud/airarrow.png new file mode 100644 index 000000000..e059ba0df Binary files /dev/null and b/data/images/engine/hud/airarrow.png differ diff --git a/src/object/player.cpp b/src/object/player.cpp index ccecefb30..f995622e4 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -116,6 +116,7 @@ Player::Player(PlayerStatus* _player_status, const std::string& name) smalltux_gameover = sprite_manager->create("images/creatures/tux_small/smalltux-gameover.sprite"); smalltux_star = sprite_manager->create("images/creatures/tux_small/smalltux-star.sprite"); bigtux_star = sprite_manager->create("images/creatures/tux_big/bigtux-star.sprite"); + airarrow.reset(new Surface("images/engine/hud/airarrow.png")); sound_manager->preload("sounds/bigjump.wav"); sound_manager->preload("sounds/jump.wav"); @@ -803,6 +804,13 @@ Player::draw(DrawingContext& context) if(!visible) return; + // if Tux is above camera, draw little "air arrow" to show where he is x-wise + if (Sector::current() && Sector::current()->camera && (get_bbox().p2.y + 16 < Sector::current()->camera->get_translation().y)) { + float px = get_pos().x + (get_bbox().p2.x - get_bbox().p1.x - airarrow.get()->get_width()) / 2; + float py = Sector::current()->camera->get_translation().y; + context.draw_surface(airarrow.get(), Vector(px, py), LAYER_HUD - 1); + } + TuxBodyParts* tux_body; if (player_status->bonus == GROWUP_BONUS) diff --git a/src/object/player.hpp b/src/object/player.hpp index a66f80b1e..2f21f6d0a 100644 --- a/src/object/player.hpp +++ b/src/object/player.hpp @@ -278,6 +278,8 @@ private: Sprite* smalltux_star; Sprite* bigtux_star; + std::auto_ptr airarrow; /**< arrow indicating Tux' position when he's above the camera */ + Vector floor_normal; void try_grab();