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>
This commit is contained in:
parent
9ff7ca5871
commit
d254452e80
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++) {
|
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.
|
//Draw the water background at double size because it's half the screen's width and height.
|
||||||
int index = y*RabiClone.BASE_WIDTH+x;
|
int index = y*RabiClone.BASE_WIDTH+x;
|
||||||
p[index] = Sprite.WATER_OVERLAY.getBi_array()[
|
byte col = Sprite.WATER_OVERLAY.getBi_array()[(y/2)*Sprite.WATER_OVERLAY.getCanvasWidth()+(x/2)];
|
||||||
(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 viewBoundaryX = RabiClone.BASE_WIDTH / 3;
|
||||||
final double viewBoundaryY = RabiClone.BASE_HEIGHT / 3;
|
final double viewBoundaryY = RabiClone.BASE_HEIGHT / 3;
|
||||||
View lastCameraView = View.FIXED;
|
View lastCameraView = View.FIXED;
|
||||||
boolean spacebarReleased = true;
|
|
||||||
boolean facing_direction = RIGHT;
|
boolean facing_direction = RIGHT;
|
||||||
boolean landedBellySlide=false;
|
boolean landedBellySlide=false;
|
||||||
|
|
||||||
@ -68,6 +67,7 @@ public class Player extends PhysicsObject{
|
|||||||
setSlidingVelocity_UseDefaultStrategy();
|
setSlidingVelocity_UseDefaultStrategy();
|
||||||
setSlidingAcceleration_UseDefaultStrategy();
|
setSlidingAcceleration_UseDefaultStrategy();
|
||||||
setJumpVelocity_UseDefaultStrategy();
|
setJumpVelocity_UseDefaultStrategy();
|
||||||
|
setMaxJumpCount_UseDefaultStrategy();
|
||||||
setGravity_UseDefaultStrategy();
|
setGravity_UseDefaultStrategy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,6 @@ public class Player extends PhysicsObject{
|
|||||||
&& state!=State.ATTACK2&&state!=State.ATTACK3&&state!=State.BELLYSLIDE) {
|
&& state!=State.ATTACK2&&state!=State.ATTACK3&&state!=State.BELLYSLIDE) {
|
||||||
y_velocity = jump_velocity;
|
y_velocity = jump_velocity;
|
||||||
}
|
}
|
||||||
System.out.println(spacebarReleased);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEventCollisions() {
|
private void handleEventCollisions() {
|
||||||
@ -235,16 +234,16 @@ public class Player extends PhysicsObject{
|
|||||||
if (state!=State.UNCONTROLLABLE) {
|
if (state!=State.UNCONTROLLABLE) {
|
||||||
setUncontrollable(0.2);
|
setUncontrollable(0.2);
|
||||||
}
|
}
|
||||||
pobj.setStagger(0.3);
|
pobj.setStagger(0.5);
|
||||||
pobj.setInvulnerability(0.4);
|
pobj.setInvulnerability(0.6);
|
||||||
pobj.x_velocity = -300;
|
pobj.x_velocity = -300;
|
||||||
pobj.y_velocity = -120;
|
pobj.y_velocity = -120;
|
||||||
}else{
|
}else{
|
||||||
if (state!=State.UNCONTROLLABLE) {
|
if (state!=State.UNCONTROLLABLE) {
|
||||||
setUncontrollable(0.2);
|
setUncontrollable(0.2);
|
||||||
}
|
}
|
||||||
pobj.setStagger(0.3);
|
pobj.setStagger(0.5);
|
||||||
pobj.setInvulnerability(0.4);
|
pobj.setInvulnerability(0.6);
|
||||||
pobj.x_velocity = 300;
|
pobj.x_velocity = 300;
|
||||||
pobj.y_velocity = -120;
|
pobj.y_velocity = -120;
|
||||||
}
|
}
|
||||||
@ -256,7 +255,6 @@ public class Player extends PhysicsObject{
|
|||||||
public void KeyReleased(Action a) {
|
public void KeyReleased(Action a) {
|
||||||
if (a == Action.JUMP) {
|
if (a == Action.JUMP) {
|
||||||
spacebarPressed = 0;
|
spacebarPressed = 0;
|
||||||
spacebarReleased=true;
|
|
||||||
}
|
}
|
||||||
if (state != State.SLIDE&&state!=State.BELLYSLIDE) {
|
if (state != State.SLIDE&&state!=State.BELLYSLIDE) {
|
||||||
if ((a == Action.MOVE_LEFT) && (KeyHeld(Action.MOVE_RIGHT))) {
|
if ((a == Action.MOVE_LEFT) && (KeyHeld(Action.MOVE_RIGHT))) {
|
||||||
@ -331,13 +329,12 @@ public class Player extends PhysicsObject{
|
|||||||
weaponSwingTime=RabiClone.TIME;
|
weaponSwingTime=RabiClone.TIME;
|
||||||
}
|
}
|
||||||
if (groundCollision||isUnderwater()) {
|
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;
|
state = State.JUMP;
|
||||||
jumpCount--;
|
jumpCount--;
|
||||||
y_velocity = jump_velocity;
|
y_velocity = jump_velocity;
|
||||||
spacebarPressed = RabiClone.TIME;
|
spacebarPressed = RabiClone.TIME;
|
||||||
spacebarReleased=false;
|
//System.out.println("Jump");
|
||||||
System.out.println("Jump");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state != State.SLIDE&&state!=State.BELLYSLIDE) {
|
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 gravity = GRAVITY;
|
||||||
protected double x_acceleration,y_acceleration;
|
protected double x_acceleration,y_acceleration;
|
||||||
protected boolean groundCollision;
|
protected boolean groundCollision;
|
||||||
protected byte jumpCount=0;
|
|
||||||
protected byte maxJumpCount=2;
|
protected byte maxJumpCount=2;
|
||||||
|
protected byte jumpCount=maxJumpCount;
|
||||||
protected double x_velocity_limit,y_velocity_limit;
|
protected double x_velocity_limit,y_velocity_limit;
|
||||||
protected double x_acceleration_limit,y_acceleration_limit;
|
protected double x_acceleration_limit,y_acceleration_limit;
|
||||||
protected double jump_velocity;
|
protected double jump_velocity;
|
||||||
|
@ -19,6 +19,7 @@ public class BlueBun extends BunnyGirls{
|
|||||||
setSlidingVelocity_UseDefaultStrategy();
|
setSlidingVelocity_UseDefaultStrategy();
|
||||||
setSlidingAcceleration_UseDefaultStrategy();
|
setSlidingAcceleration_UseDefaultStrategy();
|
||||||
setJumpVelocity_UseDefaultStrategy();
|
setJumpVelocity_UseDefaultStrategy();
|
||||||
|
setMaxJumpCount_UseDefaultStrategy();
|
||||||
setGravity_UseHalfStrategy(950);
|
setGravity_UseHalfStrategy(950);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ public class GreenBun extends BunnyGirls{
|
|||||||
setSlidingVelocity_UseDefaultStrategy();
|
setSlidingVelocity_UseDefaultStrategy();
|
||||||
setSlidingAcceleration_UseDefaultStrategy();
|
setSlidingAcceleration_UseDefaultStrategy();
|
||||||
setJumpVelocity_UseDefaultStrategy();
|
setJumpVelocity_UseDefaultStrategy();
|
||||||
|
setMaxJumpCount_UseDefaultStrategy();
|
||||||
setGravity_UseHalfStrategy(1550);
|
setGravity_UseHalfStrategy(1550);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ public class RedBun extends BunnyGirls{
|
|||||||
setSlidingVelocity_UseDefaultStrategy();
|
setSlidingVelocity_UseDefaultStrategy();
|
||||||
setSlidingAcceleration_UseDefaultStrategy();
|
setSlidingAcceleration_UseDefaultStrategy();
|
||||||
setJumpVelocity_UseDefaultStrategy();
|
setJumpVelocity_UseDefaultStrategy();
|
||||||
|
setMaxJumpCount_UseDefaultStrategy();
|
||||||
setGravity_UseHalfStrategy(750);
|
setGravity_UseHalfStrategy(750);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ public class YellowBun extends BunnyGirls{
|
|||||||
setSlidingVelocity_UseDefaultStrategy();
|
setSlidingVelocity_UseDefaultStrategy();
|
||||||
setSlidingAcceleration_UseDefaultStrategy();
|
setSlidingAcceleration_UseDefaultStrategy();
|
||||||
setJumpVelocity_UseDefaultStrategy();
|
setJumpVelocity_UseDefaultStrategy();
|
||||||
|
setMaxJumpCount_UseDefaultStrategy();
|
||||||
setGravity_UseHalfStrategy(150);
|
setGravity_UseHalfStrategy(150);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user