#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
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;
}
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;
/** 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();
if(under_solid())
{
// fall down
- physic.set_velocity(physic.get_velocity_x(), 0);
+ physic.set_velocity_y(0);
jumped_in_solid = true;
}
}
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);
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)
{
jumping = false;
if(physic.get_velocity_y() > 0) {
- physic.set_velocity(physic.get_velocity_x(), 0);
+ physic.set_velocity_y(0);
}
}
}