- added holding gfx, still looks rather stupid, but I think thats unavoidable without...
authorIngo Ruhnke <grumbel@gmx.de>
Sat, 24 Apr 2004 12:30:21 +0000 (12:30 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Sat, 24 Apr 2004 12:30:21 +0000 (12:30 +0000)
SVN-Revision: 679

src/player.cpp
src/player.h

index 389c6b3..23361f7 100644 (file)
@@ -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;
             }
index 0dcca5f..15291d3 100644 (file)
@@ -129,6 +129,7 @@ public:
   bool got_coffee;
   int size;
   bool duck;
+  bool holding_something;
   DyingType dying;
 
   Direction dir;