SLope but it works

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
unknown 3 years ago
parent 4edcc62e99
commit 0fc9aee919
  1. BIN
      bin/sig/objects/Player.class
  2. BIN
      maps/world1.map
  3. 6
      src/sig/objects/Player.java

Binary file not shown.

Binary file not shown.

@ -370,8 +370,13 @@ public class Player extends AnimatedObject{
Tile checked_tile_top_right = RabiClone.CURRENT_MAP.getTile((int)(getX()+getAnimatedSpr().getWidth()/2-4+check_distance_x)/Tile.TILE_WIDTH, (int)(getY()+getAnimatedSpr().getHeight()/2)/Tile.TILE_HEIGHT);
Tile checked_tile_top_left = RabiClone.CURRENT_MAP.getTile((int)(getX()-getAnimatedSpr().getWidth()/2+4+check_distance_x)/Tile.TILE_WIDTH, (int)(getY()+getAnimatedSpr().getHeight()/2)/Tile.TILE_HEIGHT);
Tile checked_tile_bottom_center = RabiClone.CURRENT_MAP.getTile((int)(getX())/Tile.TILE_WIDTH, (int)(getY()+getAnimatedSpr().getHeight()/2)/Tile.TILE_HEIGHT);
if(checked_tile_top_right.getCollision()==CollisionType.BLOCK||checked_tile_top_left.getCollision()==CollisionType.BLOCK){
//System.out.println(checked_tile_top_right.getCollision()+"//"+checked_tile_top_left.getCollision());
if(checked_tile_bottom_center.getCollision()==CollisionType.SLOPE){
}else{
if (checked_tile_top_right.getCollision()==CollisionType.BLOCK) {
setX(((int)(getX()-getAnimatedSpr().getWidth()/2)/Tile.TILE_WIDTH)*Tile.TILE_WIDTH+Tile.TILE_WIDTH/2+3+check_distance_x);
} else {
@ -380,6 +385,7 @@ public class Player extends AnimatedObject{
x_acceleration = 0;
x_velocity = Math.signum(x_velocity)*0.000001;
sideCollision=true;
}
}
}
if (y_velocity==0) {

Loading…
Cancel
Save