From: Ingo Ruhnke Date: Tue, 20 Apr 2004 17:31:11 +0000 (+0000) Subject: - switched gamespeed back to normal X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=74ab009aba10e7bed5ad9aa7e1217b7fb1518bf3;p=supertux.git - switched gamespeed back to normal - added high-jump while running SVN-Revision: 595 --- diff --git a/src/defines.h b/src/defines.h index 1116b5cbe..ef93b9337 100644 --- a/src/defines.h +++ b/src/defines.h @@ -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 diff --git a/src/globals.cpp b/src/globals.cpp index 50cab212f..632f383e2 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -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; diff --git a/src/physic.cpp b/src/physic.cpp index 476565f97..edd976cd3 100644 --- a/src/physic.cpp +++ b/src/physic.cpp @@ -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; diff --git a/src/physic.h b/src/physic.h index 0e15cfa75..8e467d777 100644 --- a/src/physic.h +++ b/src/physic.h @@ -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(); diff --git a/src/player.cpp b/src/player.cpp index 5018a6176..4f52d343a 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -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); } } }