From: Ingo Ruhnke Date: Sat, 24 Apr 2004 12:30:21 +0000 (+0000) Subject: - added holding gfx, still looks rather stupid, but I think thats unavoidable without... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=db47487de295bd954789f5cddf2aecaba2a008a3;p=supertux.git - added holding gfx, still looks rather stupid, but I think thats unavoidable without major changes to the current code SVN-Revision: 679 --- diff --git a/src/player.cpp b/src/player.cpp index 389c6b334..23361f7cd 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -101,6 +101,8 @@ Player::init() { Level* plevel = World::current()->get_level(); + holding_something = false; + base.width = 32; base.height = 32; @@ -190,6 +192,9 @@ Player::action(double frame_ratio) { bool jumped_in_solid = false; + if (input.fire == UP) + holding_something = false; + /* Move tux: */ previous_base = base; @@ -572,6 +577,14 @@ Player::draw() else smalltux_skid_left->draw(base.x - scroll_x, base.y); } + + if (holding_something && physic.get_velocity_y() == 0) + { + if (dir == RIGHT) + smalltux_grab_right->draw(base.x - scroll_x, base.y); + else + smalltux_grab_left->draw(base.x - scroll_x, base.y); + } } else // Large Tux { @@ -673,8 +686,16 @@ Player::draw() duckfiretux_left->draw( base.x- scroll_x - 8, base.y - 16); } } + + if (holding_something && !duck && physic.get_velocity_y() == 0) + { + if (dir == RIGHT) + largetux_grab_right->draw(base.x - scroll_x, base.y); + else + largetux_grab_left->draw(base.x - scroll_x, base.y); + } } - } + } } if (debug_mode) @@ -698,6 +719,7 @@ Player::collision(void* p_c_object, int c_object) { if (pbad_c->mode == BadGuy::FLAT && input.fire == DOWN) { + holding_something = true; pbad_c->mode = BadGuy::HELD; pbad_c->base.y-=8; } diff --git a/src/player.h b/src/player.h index 0dcca5fda..15291d38c 100644 --- a/src/player.h +++ b/src/player.h @@ -129,6 +129,7 @@ public: bool got_coffee; int size; bool duck; + bool holding_something; DyingType dying; Direction dir;