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

Make the movement behaviour consistent with the original game. #2

Merged
merged 1 commit into from Apr 5, 2017

Conversation

@N2OMatt
Copy link
Contributor

N2OMatt commented Apr 4, 2017

The previous behaviour was wrong since it was creating a new
"block" even no changes was made in the table. This way if
the player gets "stucked" he could only keep trying the same
movement direction and a new block will be created every time.

In the original game a new block only is spawned if the "table"
state gets changes, i.e the player must do a valid move to a new
block get spawned.

We accomplish that by copying the current TABLE that is passed
to the key() function. This way we can compare the previous and
now "current" state of the table to check if a move was did.
Only then, we spawn a new block.

Make a little bit of refactoring on the main loop, since previously
we have too much code duplicated.

Remove the inconsistency of tabs vs spaces.

The previous behaviour was wrong since it was creating a new
"block" even no changes was made in the table. This way if
the player gets "stucked" he could only keep trying the same
movement direction and a new block will be created every time.

In the original game a new block only is spawned if the "table"
state gets changes, i.e the player must do a valid move to a new
block get spawned.

We accomplish that by copying the current TABLE that is passed
to the key() function. This way we can compare the previous and
now "current" state of the table to check if a move was did.
Only then, we spawn a new block.

Make a little bit of refactoring on the main loop, since previously
we have too much code duplicated.

Remove the inconsistency of tabs vs spaces.
@davidsousarj davidsousarj merged commit 05a1541 into davidsousarj:master Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.