Add new brick shapes.

This commit is contained in:
Matt Low 2018-11-20 21:38:01 +04:00
parent 2a398725f5
commit ef698a38c1
2 changed files with 64 additions and 0 deletions

View File

@ -165,6 +165,62 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener {
0, -BRICK_HEIGHT/2, // Bottom left
});
break;
case RIGHT_DOWN_RIGHT_TRIANGLE:
brickShape.set(new float[] {
BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top right
BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom right
0, -BRICK_HEIGHT/2, // Bottom left
});
break;
case RIGHT_UP_RIGHT_TRIANGLE:
brickShape.set(new float[] {
BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top right
BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom right
0, BRICK_HEIGHT/2, // Top left
});
break;
case RIGHT_UP_LEFT_TRIANGLE:
brickShape.set(new float[] {
0, BRICK_HEIGHT/2, // Top left
BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top right
0, -BRICK_HEIGHT/2, // Bottom left
});
break;
case RIGHT_DOWN_LEFT_TRIANGLE:
brickShape.set(new float[] {
0, BRICK_HEIGHT/2, // Top left
BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom right
0, -BRICK_HEIGHT/2, // Bottom left
});
break;
case LEFT_DOWN_RIGHT_TRIANGLE:
brickShape.set(new float[] {
0, BRICK_HEIGHT/2, // Top right
0, -BRICK_HEIGHT/2, // Bottom right
-BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom left
});
break;
case LEFT_UP_RIGHT_TRIANGLE:
brickShape.set(new float[] {
0, BRICK_HEIGHT/2, // Top right
0, -BRICK_HEIGHT/2, // Bottom right
-BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top left
});
break;
case LEFT_UP_LEFT_TRIANGLE:
brickShape.set(new float[] {
-BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top left
0, BRICK_HEIGHT/2, // Top right
-BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom left
});
break;
case LEFT_DOWN_LEFT_TRIANGLE:
brickShape.set(new float[] {
-BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top left
0, -BRICK_HEIGHT/2, // Bottom right
-BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom left
});
break;
default:
brickShape.setAsBox(BRICK_WIDTH/2, BRICK_HEIGHT/2, Vector2.Zero, 0f);
}

View File

@ -12,6 +12,14 @@ public enum BrickShape {
HALF_LOWER,
HALF_LEFT,
HALF_RIGHT,
RIGHT_DOWN_RIGHT_TRIANGLE,
RIGHT_UP_RIGHT_TRIANGLE,
RIGHT_UP_LEFT_TRIANGLE,
RIGHT_DOWN_LEFT_TRIANGLE,
LEFT_DOWN_RIGHT_TRIANGLE,
LEFT_UP_RIGHT_TRIANGLE,
LEFT_UP_LEFT_TRIANGLE,
LEFT_DOWN_LEFT_TRIANGLE,
;
}