Rising checks now in place

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 2 years ago
parent fd697a3f39
commit 9b36f2542d
  1. 2
      src/sig/objects/LevelRenderer.java
  2. 22
      src/sig/objects/Player.java

@ -76,7 +76,7 @@ public class LevelRenderer extends Object{
}
if (RabiClone.player!=null) {
Draw_Animated_Object(RabiClone.player,RabiClone.player.facing_direction?Transform.HORIZONTAL:Transform.NONE);
Draw_Text(4,4,new String(RabiClone.player.x_velocity),Font.PROFONT_12);
Draw_Text(4,4,new String(RabiClone.player.y_velocity),Font.PROFONT_12);
Draw_Text(4,4+Font.PROFONT_12.getGlyphHeight(),new String(RabiClone.player.slide_time3),Font.PROFONT_12);
}
//RenderCollisionGrid(p);

@ -400,8 +400,9 @@ public class Player extends AnimatedObject implements CollisionEntity {
groundCollision=true;
jumpCount=maxJumpCount;
}
}
} else {
double startingY=getY();
groundCollision=false;
if (displacement_y>0) {
for (int y=(int)getY();y<startingY+displacement_y;y++) {
if (y==getY()) {
@ -418,19 +419,20 @@ public class Player extends AnimatedObject implements CollisionEntity {
break;
}
}
}/* else {
for (int x=(int)getX();x>startingX+displacement_x;x--) {
if (x==getX()) {
} else {
for (int y=(int)getY();y>startingY+displacement_y;y--) {
if (y==getY()) {
continue;
}
if (checkCollision((x-RabiClone.level_renderer.getX()+getCollisionBox().getX()-getSprite().getWidth()/2),getY()-RabiClone.level_renderer.getY()-getSprite().getHeight()/2+getCollisionBounds().getY2())) {
x_acceleration = 0;
x_velocity = Math.signum(x_velocity)*0.000001;
sideCollision=true;
setX(x+1);
if (checkCollision(getX()-RabiClone.level_renderer.getX(),y-RabiClone.level_renderer.getY()+getCollisionBox().getY()-getSprite().getHeight()/2)) {
setY(y+1);
y_acceleration = 0;
y_velocity = 0;
break;
}
}
}
}
}*/
if (!groundCollision){
this.setY(this.getY()+displacement_y);
y_acceleration = GRAVITY;

Loading…
Cancel
Save