Restore spacebar release functionality
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
52f6d8a430
commit
9ff7ca5871
Binary file not shown.
@ -31,6 +31,7 @@ public class LevelRenderer extends Object{
|
||||
|
||||
public final static byte MAX_RIPPLE_SIZE = (byte)4;
|
||||
public final static byte RIPPLE_CHANCE = (byte)3;
|
||||
public final static byte RIPPLE_DROP_CHANCE = (byte)6;
|
||||
/**
|
||||
*Ripples will store bit 8 for the direction the ripple is moving. Bits 1-7 are used as the actual value for ripples up to 64 in size (Half used for movement in each direction).
|
||||
*/
|
||||
@ -72,6 +73,7 @@ public class LevelRenderer extends Object{
|
||||
} else {
|
||||
ripples[selectedIndex]=(byte)(MAX_RIPPLE_SIZE|0b00000000);
|
||||
}
|
||||
System.out.println("Ripple "+selectedIndex+" started. Dir:"+(((ripples[selectedIndex]&0b10000000)==0b10000000)?"left":"right"));
|
||||
}
|
||||
}
|
||||
for (int i=0;i<ripples.length;i++) {
|
||||
@ -82,6 +84,11 @@ public class LevelRenderer extends Object{
|
||||
if ((ripples[i]&0b1111111)==0) //Flip the sign.
|
||||
{
|
||||
ripples[i]=(byte)(((ripples[i]&0b1111111)+1));
|
||||
System.out.println(" Ripple "+i+" is now at value "+(ripples[i]&0b1111111));
|
||||
} else
|
||||
if ((ripples[i]&0b1111111)==MAX_RIPPLE_SIZE&&Math.random()*RIPPLE_DROP_CHANCE<1) {
|
||||
ripples[i]=0;
|
||||
System.out.println(" Reset ripple "+i);
|
||||
}
|
||||
} else {
|
||||
//We are moving right.
|
||||
@ -89,6 +96,11 @@ public class LevelRenderer extends Object{
|
||||
if ((ripples[i]&0b1111111)==MAX_RIPPLE_SIZE*2) //Flip the sign.
|
||||
{
|
||||
ripples[i]=(byte)((ripples[i]&0b10000000)+((ripples[i]&0b1111111)-1));
|
||||
System.out.println(" Ripple "+i+" is now at value "+(ripples[i]&0b1111111));
|
||||
} else
|
||||
if ((ripples[i]&0b1111111)==MAX_RIPPLE_SIZE&&Math.random()*RIPPLE_DROP_CHANCE<1) {
|
||||
ripples[i]=0;
|
||||
System.out.println(" Reset ripple "+i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ 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;
|
||||
|
||||
@ -211,7 +212,7 @@ public class Player extends PhysicsObject{
|
||||
&& state!=State.ATTACK2&&state!=State.ATTACK3&&state!=State.BELLYSLIDE) {
|
||||
y_velocity = jump_velocity;
|
||||
}
|
||||
// System.out.println(state);
|
||||
System.out.println(spacebarReleased);
|
||||
}
|
||||
|
||||
private void handleEventCollisions() {
|
||||
@ -255,6 +256,7 @@ 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))) {
|
||||
@ -329,12 +331,13 @@ public class Player extends PhysicsObject{
|
||||
weaponSwingTime=RabiClone.TIME;
|
||||
}
|
||||
if (groundCollision||isUnderwater()) {
|
||||
if (a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) {
|
||||
if (spacebarReleased&&jumpCount>0&&a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) {
|
||||
state = State.JUMP;
|
||||
jumpCount--;
|
||||
y_velocity = jump_velocity;
|
||||
spacebarPressed = RabiClone.TIME;
|
||||
// System.out.println("Jump");
|
||||
spacebarReleased=false;
|
||||
System.out.println("Jump");
|
||||
}
|
||||
}
|
||||
if (state != State.SLIDE&&state!=State.BELLYSLIDE) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user