Add additional brick shapes

This commit is contained in:
Matt Low 2018-11-15 22:04:29 +04:00
parent 4fa5841fb2
commit e116f1064d
2 changed files with 62 additions and 8 deletions

View File

@ -113,11 +113,71 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener {
case DIAMOND:
brickShape.set(new float[] {
-BRICK_WIDTH/2, 0, // Left
0, BRICK_HEIGHT/2, // UP
0, BRICK_HEIGHT/2, // Up
BRICK_WIDTH/2, 0, // Right
0, -BRICK_HEIGHT/2 // Down
});
break;
case DOWN_RIGHT_TRIANGLE:
brickShape.set(new float[] {
BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top right
BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom right
-BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom left
});
break;
case UP_RIGHT_TRIANGLE:
brickShape.set(new float[] {
BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top right
BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom right
-BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top left
});
break;
case UP_LEFT_TRIANGLE:
brickShape.set(new float[] {
-BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top left
BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top right
-BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom left
});
break;
case DOWN_LEFT_TRIANGLE:
brickShape.set(new float[] {
-BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top left
BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom right
-BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom left
});
break;
case HALF_LOWER:
brickShape.set(new float[] {
-BRICK_WIDTH/2, 0, // Top left
BRICK_WIDTH/2, 0, // Top right
BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom right
-BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom left
});
break;
case HALF_UPPER:
brickShape.set(new float[] {
-BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top left
BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top right
BRICK_WIDTH/2, 0, // Bottom right
-BRICK_WIDTH/2, 0, // Bottom left
});
break;
case HALF_LEFT:
brickShape.set(new float[] {
-BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top left
0, BRICK_HEIGHT/2, // Top right
0, -BRICK_HEIGHT/2, // Bottom right
-BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom left
});
break;
case HALF_RIGHT:
brickShape.set(new float[] {
0, BRICK_HEIGHT/2, // Top left
BRICK_WIDTH/2, BRICK_HEIGHT/2, // Top right
BRICK_WIDTH/2, -BRICK_HEIGHT/2, // Bottom right
0, -BRICK_HEIGHT/2, // Bottom left
});
break;
default:
brickShape.setAsBox(BRICK_WIDTH/2, BRICK_HEIGHT/2, Vector2.Zero, 0f);
}

View File

@ -8,16 +8,10 @@ public enum BrickShape {
UP_RIGHT_TRIANGLE,
UP_LEFT_TRIANGLE,
DOWN_LEFT_TRIANGLE,
HALF_LOWER,
HALF_UPPER,
HALF_LOWER,
HALF_LEFT,
HALF_RIGHT,
THIRD_LEFT,
THIRD_HMIDDLE,
THIRD_RIGHT,
THIRD_UPPER,
THIRD_VMIDDLE,
THIRD_LOWER,
;
}