From 9f98af91f3501e30ff59e42b8d9e056f5c8064ba Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Sat, 28 Oct 2006 12:09:59 +0000 Subject: [PATCH] Added litte "air arrow" to show where Tux is when he's above the camera. Graphics are just a placeholder. SVN-Revision: 4425 --- data/images/engine/hud/airarrow.png | Bin 0 -> 438 bytes src/object/player.cpp | 8 ++++++++ src/object/player.hpp | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 data/images/engine/hud/airarrow.png diff --git a/data/images/engine/hud/airarrow.png b/data/images/engine/hud/airarrow.png new file mode 100644 index 0000000000000000000000000000000000000000..e059ba0dfb0511de4ba5312aa638c58f550b2c0a GIT binary patch literal 438 zcmV;n0ZIOeP)>*)Xh0Ygbd zK~y-)mD9gU98na<@z32|VivL4CPi!vC|dglQ>79#L~LxV6p7DZzb_$}K%QZX0UIH# zjpQH1Mr$Rzq6pcrdu{IMuvsT~U|@zhzjMF8-ESmZ+K^6tP#0uJ&O$1-@0mpeToJf#Gb-ckY_VGH2BNniOx$#Uw5f+xQ zjkkD(5pM7o)3{7_KH}@$i8l4@OyZiXX{yJrR}ZF7OdE=oJ|}SjdAB z{**Q{UNH~)S#+I;$KjQq>7*))$3y(*#FCBpR8ylu{5!2vx{uEpFig8|r{`{w`g8uq gkhTHCaqmUl16IRj1`lf28UO$Q07*qoM6N<$f;xn?*Z=?k literal 0 HcmV?d00001 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(); -- 2.11.0