From e116f1064ddd01764b8d188117424afa29da6442 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Thu, 15 Nov 2018 22:04:29 +0400 Subject: [PATCH] Add additional brick shapes --- core/src/com/me/brickbuster/entity/Brick.java | 62 ++++++++++++++++++- .../com/me/brickbuster/entity/BrickShape.java | 8 +-- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/core/src/com/me/brickbuster/entity/Brick.java b/core/src/com/me/brickbuster/entity/Brick.java index f7a21ab..24cccc9 100644 --- a/core/src/com/me/brickbuster/entity/Brick.java +++ b/core/src/com/me/brickbuster/entity/Brick.java @@ -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); } diff --git a/core/src/com/me/brickbuster/entity/BrickShape.java b/core/src/com/me/brickbuster/entity/BrickShape.java index e35915d..2d520e7 100644 --- a/core/src/com/me/brickbuster/entity/BrickShape.java +++ b/core/src/com/me/brickbuster/entity/BrickShape.java @@ -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, ; }