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

Add Features...and some bugfixes #14

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

sys58260
Copy link

Hi Ivan,

I saw your project some weeks ago when i was doing some experiments with Avalonia in Linux, and i found your tetris implementation inspiring so I decided to try to play with your code...and so i went to having fun and i tried to add some fancy ideas or fixing some bugs. I noted too late that you had added the "Show next piece" feature, when i already played to add that, thus not yet commited at time, but please take a look at my implementation.

So, below i'm summarizing the changes in this PR:

  • Fixed Level counting : When restarting the level was 1 instead of 0
  • Added Blinking Removing lines
  • Added Turn On\Off Grid : Note doesn't work with compiled bindings
  • Renamed indexColor (previous was "type" property to FillType in GridPoint
  • Fixed some bugs in "for" cycles limits
  • Added Next Piece visualization.
  • Fixed bug preventing showing of S2 and L2 pieces, extended indexcolor converter for supporting these 2 pieces
  • Using Enum for Pieces typing and grid filling, with ad hoc color converter.
  • Added Parametric Grid Dimensions: Via MainGridHorizontalDimension and MainGridVerticalDimension you can set the grid game dimension

I colud agree that the changes in the code could be somewhat "invasive" but take they as your discretion.
The grid on\off could be subjective aesthetic. The next piece as no grid at all.
The blinking of the lines that are about to be removed is a thing that i saw on some old Tetris, so i decided could be nice to have. I know it could be implement differently (by using Storyboard?), but i think the current is straightforward.
Moreover, the game area dimensions are easily modifiable with two parameters, varing the difficult of the game.

Looking forward to your reply,
Best regards.
DM

P.s
This is my first PR, so let me know if you need other details or how can i do more effectively.

Some refactorings, added parameters for grid dimensions in order to avoid sparse and repeated use of dimension number in code.
Fixed bug preventing showing of s2 and l2 pieces, extended indexcolor converter for supporting these 2 pieces,
Renamed i"type" property in Piece class to IndexColor
Fixed end game detection,
added parameters on Piece constructor to inizialize position
Decoupled Game class from Avalonia: use an enum to express grid fill
changed color converter by using the aforementioned enum
changed indexColor (previous was "type" property yo FillType
fixed some bugs in for cycles limits
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

Successfully merging this pull request may close these issues.

1 participant