Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Comments

✨ feat(brick): add BrickComponent and variants (Explode, Power, Protected) with BrickFactory#9

Closed
ManhTanTran wants to merge 13 commits intomainfrom
feature/brick
Closed

✨ feat(brick): add BrickComponent and variants (Explode, Power, Protected) with BrickFactory#9
ManhTanTran wants to merge 13 commits intomainfrom
feature/brick

Conversation

@ManhTanTran
Copy link
Collaborator

🧩 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.

Copilot AI review requested due to automatic review settings October 7, 2025 18:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Brick class with component-based BrickComponent architecture
  • Introduces specialized brick types: ExplodeBrick, PowerBrick, and ProtectedBrick
  • Adds BrickFactory for entity creation and GameManager for 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.

Comment on lines +44 to +45
List<Entity> entites = FXGL.getGameWorld().getEntities();
for (Entity e : entites) {
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'entites' to 'entities'.

Suggested change
List<Entity> entites = FXGL.getGameWorld().getEntities();
for (Entity e : entites) {
List<Entity> entities = FXGL.getGameWorld().getEntities();
for (Entity e : entities) {

Copilot uses AI. Check for mistakes.
bullets.add(bulletRight);
}

/** Updates all bullets when them get off-screen or hit the brick. */
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar error: 'when them get' should be 'when they go'.

Suggested change
/** Updates all bullets when them get off-screen or hit the brick. */
/** Updates all bullets when they go off-screen or hit a brick. */

Copilot uses AI. Check for mistakes.
Comment on lines +80 to +89
for (Entity brickEntity : bricks) {
if (!brickEntity.hasComponent(BrickComponent.class))
continue;

BrickComponent brick = brickEntity.getComponent(BrickComponent.class);
if (brick.isDestroyed()) {
score += brick.getScore();
brickEntity.removeFromWorld();
}
}
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Entity bulletLeft = FXGL.entityBuilder()
.at(bulletLeftX, bulletLeftY)
.type(BounceverseType.BULLET)
.viewWithBBox("")
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Empty view string should be replaced with proper bullet visualization for better gameplay experience.

Copilot uses AI. Check for mistakes.
@ManhTanTran ManhTanTran requested a review from Copilot October 7, 2025 18:24
@ManhTanTran ManhTanTran self-assigned this Oct 7, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +79 to +90
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();
}
}
}
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying the collection while iterating can cause ConcurrentModificationException. Use an Iterator or collect entities to remove in a separate list first.

Copilot uses AI. Check for mistakes.
@thnhmai06 thnhmai06 closed this Oct 7, 2025
@thnhmai06 thnhmai06 deleted the feature/brick branch October 7, 2025 19:44
@thnhmai06
Copy link
Member

thnhmai06 commented Oct 8, 2025

already on #12

@ManhTanTran ManhTanTran restored the feature/brick branch October 8, 2025 07:54
@ManhTanTran ManhTanTran deleted the feature/brick branch October 14, 2025 08:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants