From 7b89ed7dcceff995683a13c67cc27fec324ab049 Mon Sep 17 00:00:00 2001 From: unknown <45179536+r3cp3ct@users.noreply.github.com> Date: Sun, 5 Jun 2022 13:20:39 +0300 Subject: [PATCH] Basic sliding bug fixes Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 --- maps/world1.map | Bin 295488 -> 295488 bytes src/sig/objects/Player.java | 57 ++++++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/maps/world1.map b/maps/world1.map index b86a24de59b907788291a7065456bd3a77d67446..bbcd34be50c8218418dc9611140838635415fd21 100644 GIT binary patch delta 76 zcmX@mB6OfdXah6HWP1;;&6YAJm?tXeES4`|nJix*vRS_14KtJ@1LQnm28wD;md_Dt Wwv}nOm0<*8CLm_sZY#sWoCW~tVHfcL delta 62 zcmX@mB6OfdXah6HW_gK6%o7!47Rwi~AmhpM1zMBkbA+00W!i0J7=f4xh?%$B%CIn} F0RVw)5?25K diff --git a/src/sig/objects/Player.java b/src/sig/objects/Player.java index cbf05d5..4c3ceb4 100644 --- a/src/sig/objects/Player.java +++ b/src/sig/objects/Player.java @@ -16,6 +16,7 @@ import java.awt.event.KeyEvent; public class Player extends AnimatedObject{ final double GRAVITY = 1300; final double NORMAL_FRICTION = 6400; + final double NORMAL_JUMP_VELOCITY = -300; final boolean LEFT = false; final boolean RIGHT = true; final int jump_fall_AnimationWaitTime = 200; @@ -29,14 +30,15 @@ public class Player extends AnimatedObject{ double x_velocity = 0; double x_velocity_limit = 164; double y_velocity = 5; - double y_velocity_limit = 400; + double y_velocity_limit = 500; + double sliding_velocity = 164; double horizontal_drag = 2000; double horizontal_friction = NORMAL_FRICTION; double horizontal_air_drag = 800; double horizontal_air_friction = 180; - double jump_velocity = -300; + double jump_velocity = NORMAL_JUMP_VELOCITY; int maxJumpCount=2; int jumpCount=maxJumpCount; @@ -85,6 +87,7 @@ public class Player extends AnimatedObject{ } break; case IDLE: + jump_velocity = NORMAL_JUMP_VELOCITY; horizontal_friction = NORMAL_FRICTION; jump_slide_fall_StartAnimationTimer=-1; @@ -106,6 +109,9 @@ public class Player extends AnimatedObject{ } break; case JUMP: + if(prvState==State.SLIDE){ + //jump_velocity=-500; + } if(jump_slide_fall_StartAnimationTimer==-1){ jump_slide_fall_StartAnimationTimer = System.currentTimeMillis(); setAnimatedSpr(Sprite.ERINA_JUMP_RISE1); @@ -124,6 +130,12 @@ public class Player extends AnimatedObject{ setAnimatedSpr(Sprite.ERINA_SLIDE); } if(System.currentTimeMillis()-slide_time>slide_duration){ + if(KeyHeld(KeyEvent.VK_A)||KeyHeld(KeyEvent.VK_LEFT)){ + facing_direction=LEFT; + } + if(KeyHeld(KeyEvent.VK_D)||KeyHeld(KeyEvent.VK_RIGHT)){ + facing_direction=RIGHT; + } state=State.IDLE; } break; @@ -139,7 +151,7 @@ public class Player extends AnimatedObject{ if ((KeyHeld(KeyEvent.VK_SPACE)||KeyHeld(KeyEvent.VK_W))&&System.currentTimeMillis()-spacebarPressedx_velocity_limit ?Math.signum(x_velocity+x_acceleration*updateMult)*x_velocity_limit