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) { if (RabiClone.player!=null) {
Draw_Animated_Object(RabiClone.player,RabiClone.player.facing_direction?Transform.HORIZONTAL:Transform.NONE); 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); Draw_Text(4,4+Font.PROFONT_12.getGlyphHeight(),new String(RabiClone.player.slide_time3),Font.PROFONT_12);
} }
//RenderCollisionGrid(p); //RenderCollisionGrid(p);

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

Loading…
Cancel
Save