- switched gamespeed back to normal
authorIngo Ruhnke <grumbel@gmx.de>
Tue, 20 Apr 2004 17:31:11 +0000 (17:31 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Tue, 20 Apr 2004 17:31:11 +0000 (17:31 +0000)
- added high-jump while running

SVN-Revision: 595

src/defines.h
src/globals.cpp
src/physic.cpp
src/physic.h
src/player.cpp

index 1116b5c..ef93b93 100644 (file)
@@ -75,8 +75,8 @@ enum DyingType {
 
 #define GRAVITY 1.0
 #define YM_FOR_JUMP 6.0
-#define WALK_ACCELERATION_X 0.02
-#define RUN_ACCELERATION_X 0.03
+#define WALK_ACCELERATION_X 0.03
+#define RUN_ACCELERATION_X 0.04
 #define KILL_BOUNCE_YM 8.0
 
 #define SKID_XM 2.0
index 50cab21..632f383 100644 (file)
@@ -54,7 +54,7 @@ bool use_joystick;
 bool use_fullscreen;
 bool debug_mode;
 bool show_fps;
-float game_speed = 1.2f;
+float game_speed = 1.0f;
 
 int joystick_num = 0;
 char* level_startup_file = 0;
index 476565f..edd976c 100644 (file)
@@ -44,6 +44,18 @@ Physic::reset()
 }
 
 void
+Physic::set_velocity_x(float nvx)
+{
+  vx = -nvx;
+}
+
+void
+Physic::set_velocity_y(float nvy)
+{
+  vy = -nvy;
+}
+
+void
 Physic::set_velocity(float nvx, float nvy)
 {
     vx = nvx;
index 0e15cfa..8e467d7 100644 (file)
@@ -36,6 +36,9 @@ public:
     /** sets velocity to a fixed value */
     void set_velocity(float vx, float vy);
 
+    void set_velocity_x(float vx);
+    void set_velocity_y(float vy);
+
     /** velocities invertion */
     void inverse_velocity_x();
     void inverse_velocity_y();
index 5018a61..4f52d34 100644 (file)
@@ -206,7 +206,7 @@ Player::action(double frame_ratio)
           if(under_solid())
             {
               // fall down
-              physic.set_velocity(physic.get_velocity_x(), 0);
+              physic.set_velocity_y(0);
               jumped_in_solid = true;
             }
         }
@@ -216,7 +216,7 @@ Player::action(double frame_ratio)
           if (physic.get_velocity_y() < 0)
             {
               base.y = (int)(((int)base.y / 32) * 32);
-              physic.set_velocity(physic.get_velocity_x(), 0);
+              physic.set_velocity_y(0);
             }
 
           physic.enable_gravity(false);
@@ -410,7 +410,11 @@ Player::handle_vertical_input()
       if (on_ground())
         {
           // jump
-          physic.set_velocity(physic.get_velocity_x(), 5.5);
+          if (physic.get_velocity_x() > MAX_WALK_XM)
+            physic.set_velocity_y(5.8);
+          else
+            physic.set_velocity_y(5.2);
+
           --base.y;
           jumping = true;
           if (size == SMALL)
@@ -423,7 +427,7 @@ Player::handle_vertical_input()
     {
       jumping = false;
       if(physic.get_velocity_y() > 0) {
-        physic.set_velocity(physic.get_velocity_x(), 0);
+        physic.set_velocity_y(0);
       }
     }
 }