✨ feat(brick): add BrickComponent and variants (Explode, Power, Protected) with BrickFactory#9
✨ feat(brick): add BrickComponent and variants (Explode, Power, Protected) with BrickFactory#9ManhTanTran wants to merge 13 commits intomainfrom
Conversation
…Protected, Explode)
…, Bullet) with factory integration
…nagement and game world initialization
There was a problem hiding this comment.
Pull Request Overview
Implements a comprehensive brick system for the BounceVerse game with various brick types and supporting infrastructure. This adds core gameplay elements including normal, strong, explosive, and protected bricks along with paddle variants and game management.
- Replaces legacy
Brickclass with component-basedBrickComponentarchitecture - Introduces specialized brick types:
ExplodeBrick,PowerBrick, andProtectedBrick - Adds
BrickFactoryfor entity creation andGameManagerfor game state management
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| BrickComponent.java | Core brick logic with HP, color updates, and destruction handling |
| BrickFactory.java | Factory for creating different brick entity types |
| ExplodeBrick.java | Explosive brick that damages nearby bricks when destroyed |
| ProtectedBrick.java | Brick with directional shields that block hits from certain sides |
| PowerBrick.java | Special brick type (implementation to be completed) |
| GameManager.java | Central game logic manager for spawning and managing game entities |
| PaddleComponent.java | Base paddle component with movement and positioning |
| PaddleFactory.java | Factory for creating various paddle types |
| LaserPaddle.java | Paddle variant that can shoot bullets |
| ShrinkPaddle.java | Paddle variant with reduced size |
| ExpandPaddle.java | Paddle variant with increased size |
| BulletComponent.java | Component for projectiles fired by laser paddle |
| BounceverseType.java | Enum defining all game entity types |
| BounceVerseApp.java | Main application class with game initialization |
Comments suppressed due to low confidence (1)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| List<Entity> entites = FXGL.getGameWorld().getEntities(); | ||
| for (Entity e : entites) { |
There was a problem hiding this comment.
Corrected spelling of 'entites' to 'entities'.
| List<Entity> entites = FXGL.getGameWorld().getEntities(); | |
| for (Entity e : entites) { | |
| List<Entity> entities = FXGL.getGameWorld().getEntities(); | |
| for (Entity e : entities) { |
| bullets.add(bulletRight); | ||
| } | ||
|
|
||
| /** Updates all bullets when them get off-screen or hit the brick. */ |
There was a problem hiding this comment.
Grammar error: 'when them get' should be 'when they go'.
| /** Updates all bullets when them get off-screen or hit the brick. */ | |
| /** Updates all bullets when they go off-screen or hit a brick. */ |
| for (Entity brickEntity : bricks) { | ||
| if (!brickEntity.hasComponent(BrickComponent.class)) | ||
| continue; | ||
|
|
||
| BrickComponent brick = brickEntity.getComponent(BrickComponent.class); | ||
| if (brick.isDestroyed()) { | ||
| score += brick.getScore(); | ||
| brickEntity.removeFromWorld(); | ||
| } | ||
| } |
There was a problem hiding this comment.
This loop modifies the bricks list while iterating over it by calling removeFromWorld(), which could cause a ConcurrentModificationException. Use an iterator or collect entities to remove in a separate list.
| Entity bulletLeft = FXGL.entityBuilder() | ||
| .at(bulletLeftX, bulletLeftY) | ||
| .type(BounceverseType.BULLET) | ||
| .viewWithBBox("") |
There was a problem hiding this comment.
[nitpick] Empty view string should be replaced with proper bullet visualization for better gameplay experience.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| public void updateScore() { | ||
| for (Entity brickEntity : bricks) { | ||
| if (!brickEntity.hasComponent(BrickComponent.class)) | ||
| continue; | ||
|
|
||
| BrickComponent brick = brickEntity.getComponent(BrickComponent.class); | ||
| if (brick.isDestroyed()) { | ||
| score += brick.getScore(); | ||
| brickEntity.removeFromWorld(); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Modifying the collection while iterating can cause ConcurrentModificationException. Use an Iterator or collect entities to remove in a separate list first.
|
already on #12 |
🧩 Summary
This pull request adds the Brick module for the BounceVerse game, including:
BrickComponent: core logic for HP, color update, destruction.ExplodeBrick,PowerBrick,ProtectedBrick: special brick types.BrickFactory: handles entity creation for all brick types.