Remove spacebar released again after debugging jump counts and correcting them

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 2 years ago
parent 9ff7ca5871
commit d254452e80
  1. BIN
      backgrounds/water-overlay.gif
  2. 7
      src/sig/objects/LevelRenderer.java
  3. 17
      src/sig/objects/Player.java
  4. 2
      src/sig/objects/actor/PhysicsObject.java
  5. 1
      src/sig/objects/enemies/BlueBun.java
  6. 1
      src/sig/objects/enemies/GreenBun.java
  7. 1
      src/sig/objects/enemies/RedBun.java
  8. 1
      src/sig/objects/enemies/YellowBun.java

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -174,9 +174,10 @@ public class LevelRenderer extends Object{
for (int x=0;x<RabiClone.BASE_WIDTH;x++) {
//Draw the water background at double size because it's half the screen's width and height.
int index = y*RabiClone.BASE_WIDTH+x;
p[index] = Sprite.WATER_OVERLAY.getBi_array()[
(y/2)*Sprite.WATER_OVERLAY.getCanvasWidth()+(x/2)
];
byte col = Sprite.WATER_OVERLAY.getBi_array()[(y/2)*Sprite.WATER_OVERLAY.getCanvasWidth()+(x/2)];
if (col!=(byte)32) {
p[index] = col;
}
}
}
}

@ -40,7 +40,6 @@ public class Player extends PhysicsObject{
final double viewBoundaryX = RabiClone.BASE_WIDTH / 3;
final double viewBoundaryY = RabiClone.BASE_HEIGHT / 3;
View lastCameraView = View.FIXED;
boolean spacebarReleased = true;
boolean facing_direction = RIGHT;
boolean landedBellySlide=false;
@ -68,6 +67,7 @@ public class Player extends PhysicsObject{
setSlidingVelocity_UseDefaultStrategy();
setSlidingAcceleration_UseDefaultStrategy();
setJumpVelocity_UseDefaultStrategy();
setMaxJumpCount_UseDefaultStrategy();
setGravity_UseDefaultStrategy();
}
@ -212,7 +212,6 @@ public class Player extends PhysicsObject{
&& state!=State.ATTACK2&&state!=State.ATTACK3&&state!=State.BELLYSLIDE) {
y_velocity = jump_velocity;
}
System.out.println(spacebarReleased);
}
private void handleEventCollisions() {
@ -235,16 +234,16 @@ public class Player extends PhysicsObject{
if (state!=State.UNCONTROLLABLE) {
setUncontrollable(0.2);
}
pobj.setStagger(0.3);
pobj.setInvulnerability(0.4);
pobj.setStagger(0.5);
pobj.setInvulnerability(0.6);
pobj.x_velocity = -300;
pobj.y_velocity = -120;
}else{
if (state!=State.UNCONTROLLABLE) {
setUncontrollable(0.2);
}
pobj.setStagger(0.3);
pobj.setInvulnerability(0.4);
pobj.setStagger(0.5);
pobj.setInvulnerability(0.6);
pobj.x_velocity = 300;
pobj.y_velocity = -120;
}
@ -256,7 +255,6 @@ public class Player extends PhysicsObject{
public void KeyReleased(Action a) {
if (a == Action.JUMP) {
spacebarPressed = 0;
spacebarReleased=true;
}
if (state != State.SLIDE&&state!=State.BELLYSLIDE) {
if ((a == Action.MOVE_LEFT) && (KeyHeld(Action.MOVE_RIGHT))) {
@ -331,13 +329,12 @@ public class Player extends PhysicsObject{
weaponSwingTime=RabiClone.TIME;
}
if (groundCollision||isUnderwater()) {
if (spacebarReleased&&jumpCount>0&&a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) {
if (jumpCount>0&&a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) {
state = State.JUMP;
jumpCount--;
y_velocity = jump_velocity;
spacebarPressed = RabiClone.TIME;
spacebarReleased=false;
System.out.println("Jump");
//System.out.println("Jump");
}
}
if (state != State.SLIDE&&state!=State.BELLYSLIDE) {

@ -50,8 +50,8 @@ public abstract class PhysicsObject extends AnimatedObject implements PhysicsObj
protected double gravity = GRAVITY;
protected double x_acceleration,y_acceleration;
protected boolean groundCollision;
protected byte jumpCount=0;
protected byte maxJumpCount=2;
protected byte jumpCount=maxJumpCount;
protected double x_velocity_limit,y_velocity_limit;
protected double x_acceleration_limit,y_acceleration_limit;
protected double jump_velocity;

@ -19,6 +19,7 @@ public class BlueBun extends BunnyGirls{
setSlidingVelocity_UseDefaultStrategy();
setSlidingAcceleration_UseDefaultStrategy();
setJumpVelocity_UseDefaultStrategy();
setMaxJumpCount_UseDefaultStrategy();
setGravity_UseHalfStrategy(950);
}

@ -19,6 +19,7 @@ public class GreenBun extends BunnyGirls{
setSlidingVelocity_UseDefaultStrategy();
setSlidingAcceleration_UseDefaultStrategy();
setJumpVelocity_UseDefaultStrategy();
setMaxJumpCount_UseDefaultStrategy();
setGravity_UseHalfStrategy(1550);
}

@ -19,6 +19,7 @@ public class RedBun extends BunnyGirls{
setSlidingVelocity_UseDefaultStrategy();
setSlidingAcceleration_UseDefaultStrategy();
setJumpVelocity_UseDefaultStrategy();
setMaxJumpCount_UseDefaultStrategy();
setGravity_UseHalfStrategy(750);
}

@ -19,6 +19,7 @@ public class YellowBun extends BunnyGirls{
setSlidingVelocity_UseDefaultStrategy();
setSlidingAcceleration_UseDefaultStrategy();
setJumpVelocity_UseDefaultStrategy();
setMaxJumpCount_UseDefaultStrategy();
setGravity_UseHalfStrategy(150);
}

Loading…
Cancel
Save