Skip to content

Add walls to the right and left of the canvas #2

@krowter

Description

@krowter

Description

Tetris game usually have "walls" on the right and left to prevent the shapes from going beyond the game. Currently this repo doesn't have that.

Existing

If a user keeps pressing arrow right, the shape will keep moving to the right until if disappears from canvas view.

Expected

If a user keeps pressing arrow right, the shape will move to the right until it collides with the side of canvas only, no further.

Task

In the event listened inside createShape() add if statement to prevent the increment/decrement of positionX if it goes below 0 or above the canvas width.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions