diff --git a/bin/sig/map/Tile.class b/bin/sig/map/Tile.class index b252eeb..6732950 100644 Binary files a/bin/sig/map/Tile.class and b/bin/sig/map/Tile.class differ diff --git a/bin/sig/objects/Player$1.class b/bin/sig/objects/Player$1.class index d178b86..05044e1 100644 Binary files a/bin/sig/objects/Player$1.class and b/bin/sig/objects/Player$1.class differ diff --git a/bin/sig/objects/Player.class b/bin/sig/objects/Player.class index 1caf0a0..86301b4 100644 Binary files a/bin/sig/objects/Player.class and b/bin/sig/objects/Player.class differ diff --git a/maps/world1.map b/maps/world1.map index 7f141c2..ab24ca1 100644 Binary files a/maps/world1.map and b/maps/world1.map differ diff --git a/src/sig/map/Tile.java b/src/sig/map/Tile.java index 3e3482b..342ec7b 100644 --- a/src/sig/map/Tile.java +++ b/src/sig/map/Tile.java @@ -7,12 +7,12 @@ public enum Tile { PLATFORM_LEDGE(2,0,CollisionType.BLOCK), INVISIBLE_WALL(0,0,true,CollisionType.BLOCK), HIGHLIGHTED_TILE(3,0,CollisionType.BLOCK), - SMALL_SLOPE_LEFT(0,1,CollisionType.BLOCK), - SMALL_SLOPE_RIGHT(1,1,CollisionType.BLOCK), - BIG_SLOPE_LEFT1(2,1,CollisionType.BLOCK), - BIG_SLOPE_LEFT2(3,1,CollisionType.BLOCK), - BIG_SLOPE_RIGHT1(0,2,CollisionType.BLOCK), - BIG_SLOPE_RIGHT2(1,2,CollisionType.BLOCK), + SMALL_SLOPE_LEFT(0,1,CollisionType.SLOPE), + SMALL_SLOPE_RIGHT(1,1,CollisionType.SLOPE), + BIG_SLOPE_LEFT1(2,1,CollisionType.SLOPE), + BIG_SLOPE_LEFT2(3,1,CollisionType.SLOPE), + BIG_SLOPE_RIGHT1(0,2,CollisionType.SLOPE), + BIG_SLOPE_RIGHT2(1,2,CollisionType.SLOPE), ; final public static int TILE_WIDTH=32; diff --git a/src/sig/objects/Player.java b/src/sig/objects/Player.java index 3d4bd8f..1e62b48 100644 --- a/src/sig/objects/Player.java +++ b/src/sig/objects/Player.java @@ -169,6 +169,7 @@ public class Player extends AnimatedObject{ if (KeyHeld(Action.JUMP)&&RabiClone.TIME-spacebarPressed(-(getX()%Tile.TILE_WIDTH)+(int)(getY()+getAnimatedSpr().getHeight()/2)/Tile.TILE_HEIGHT*Tile.TILE_HEIGHT+(getAnimatedSpr().getHeight()/2-4))) + { + setY(-(getX()%Tile.TILE_WIDTH)+(int)(getY()+getAnimatedSpr().getHeight()/2)/Tile.TILE_HEIGHT*Tile.TILE_HEIGHT+(getAnimatedSpr().getHeight()/2-4)); + collisionOccured = groundCollision(check_distance_y); + System.out.println(checked_tile_bottom_center); + break; + } //System.out.println((int)getX()/Tile.TILE_WIDTH); if(checked_tile_bottom_right.getCollision()==CollisionType.BLOCK||checked_tile_bottom_left.getCollision()==CollisionType.BLOCK){ - setY((getY()-check_distance_y)); - y_acceleration = 0; - y_velocity = 0; - groundCollision=true; - collisionOccured=true; - state = State.IDLE; + collisionOccured = groundCollision(check_distance_y); break; } } @@ -432,6 +444,18 @@ public class Player extends AnimatedObject{ } + private boolean groundCollision(double check_distance_y) { + boolean collisionOccured; + setY((getY()-check_distance_y)); + y_acceleration = 0; + y_velocity = 0; + groundCollision=true; + collisionOccured=true; + state = State.IDLE; + return collisionOccured; + } + + private void handleKeyboardMovement(double updateMult, int movement, double friction, double drag) { if (movement!=0&&Math.abs(x_velocity)