Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect bounds checking when rotating #5

Open
silumate opened this issue May 31, 2020 · 1 comment
Open

incorrect bounds checking when rotating #5

silumate opened this issue May 31, 2020 · 1 comment

Comments

@silumate
Copy link

if(currentRotation === current.length) { //if the current rotation gets to 4, make it go back to 0

You should be checking currentRotation === theTretrominos[random].length

Instead you are comparing against the number of blocks in a tetromino (current.length).

Luckily there are no out of bounds exceptions because both the number of rotations and the number of blocks in a tetromino are 4.

@JackTheYouTuber
Copy link

I did as you said and it didn't even rotate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants