disabled hovering by default (needs tweaking!)
authorMarek Moeckel <wansti@gmx.de>
Wed, 15 Sep 2004 22:39:24 +0000 (22:39 +0000)
committerMarek Moeckel <wansti@gmx.de>
Wed, 15 Sep 2004 22:39:24 +0000 (22:39 +0000)
added cheat code "hover" to toggle hovering on/off

SVN-Revision: 1924

src/gameloop.cpp
src/player.cpp
src/player.h

index a178f49..3dbec90 100644 (file)
@@ -447,6 +447,11 @@ GameSession::process_events()
                           tux.kill(tux.KILL);
                           last_keys.clear();
                           }
+                                                               if(compare_last(last_keys, "hover"))
+                          {    // toggle hover ability on/off
+                          tux.enable_hover = !tux.enable_hover;
+                          last_keys.clear();
+                          }
                   break;
 
                 case SDL_JOYAXISMOTION:
index 114a969..af12e78 100644 (file)
@@ -161,6 +161,7 @@ Player::init()
   double_jumping = false;
   can_jump = true;
   can_double_jump = false;
+  enable_hover = false;
   butt_jump = false;
   
   frame_main = 0;
@@ -560,7 +561,9 @@ Player::handle_vertical_input()
          }
        
        // Hover
-       if (input.up == DOWN && !jumping && !butt_jump && physic.get_velocity_y() <= 0)
+   //(disabled by default, use cheat code "hover" to toggle on/off)
+       //TODO: needs some tweaking, especially when used together with double jump and jumping off badguys
+       if (enable_hover && input.up == DOWN && !jumping && !butt_jump && physic.get_velocity_y() <= 0)
          {
                        physic.set_velocity_y(-1);
          }
index 071d477..fc7c09e 100644 (file)
@@ -150,6 +150,7 @@ public:
   bool double_jumping;
   bool can_jump;
   bool can_double_jump;
+  bool enable_hover;
   bool butt_jump;
   int frame_;
   int frame_main;