From ef698a38c12a7e325c99f6bc90b601fd8eb641f8 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Tue, 20 Nov 2018 21:38:01 +0400 Subject: [PATCH] Add new brick shapes. --- core/src/com/me/brickbuster/entity/Brick.java | 56 +++++++++++++++++++ .../com/me/brickbuster/entity/BrickShape.java | 8 +++ 2 files changed, 64 insertions(+) diff --git a/core/src/com/me/brickbuster/entity/Brick.java b/core/src/com/me/brickbuster/entity/Brick.java index 9a18384..7d4066e 100644 --- a/core/src/com/me/brickbuster/entity/Brick.java +++ b/core/src/com/me/brickbuster/entity/Brick.java @@ -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); } diff --git a/core/src/com/me/brickbuster/entity/BrickShape.java b/core/src/com/me/brickbuster/entity/BrickShape.java index 2d520e7..469def5 100644 --- a/core/src/com/me/brickbuster/entity/BrickShape.java +++ b/core/src/com/me/brickbuster/entity/BrickShape.java @@ -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, ; }