TetrisAnimation icon indicating copy to clipboard operation
TetrisAnimation copied to clipboard

Led matrix 64x64 Fall problems

Open betojsp opened this issue 4 years ago • 7 comments

Hi,

I modify the variable TETRIS_Y_DROP_DEFAULT so that the fall starts much topper, change the 16 to 24.

tetris.scale = 2
/ /Main Clock
tetris1Done = tetris.drawNumbers(-6, 56, showColon);


TetrisMatrixDraw.cpp

int y = 56 - (24 * 2); // what I comment is correct ? y = 8

TETRIS_Y_DROP_DEFAULT 16

TYD_D16

TETRIS_Y_DROP_DEFAULT 24 TETRIS_Y_DROP DEFAULT 24

How can I make it start much topper ?

betojsp avatar Oct 27 '20 15:10 betojsp

HI @betojsp,

I can't try this out, because I have no 64 matrix at hand, but what about setting it to 32 then?

toblum avatar Oct 30 '20 19:10 toblum

If I remember right, The second param to draw numbers is the bottom line of where the numbers finish. 59 means it will be down near the bottom, try 30

On Fri 30 Oct 2020, 19:18 Tobias Blum, [email protected] wrote:

HI @betojsp https://github.com/betojsp,

I can't try this out, because I have no 64 matrix at hand, but what about setting it to 32 then?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/toblum/TetrisAnimation/issues/11#issuecomment-719748164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5PQVJDRWEUQ7O6UN536TSNMGRXANCNFSM4TBAF4OQ .

witnessmenow avatar Oct 30 '20 20:10 witnessmenow

TETRIS_Y_DROP_DEFAULT = 30

30

TETRIS_Y_DROP_DEFAULT = 8

8

betojsp avatar Oct 30 '20 21:10 betojsp

Ah, I understand better now.

There seems to be a bug ok. When you change the drop value, it is starting in the desired place, but it still only falls 16 * scale pixels.

It's a long time since I looked at this, but it's possible changes need to be made in Tetris numbers.h too to allow for this.

The different numbers have each shape defined like this

{2, 5, 4, 16, 0},

The second last number (16 in the example) is how far below the start it should stop.

Where the value is 16, it should be default y drop

If the value is 12 if should be default y drop - 4

And so on. Hope this helps

https://github.com/toblum/TetrisAnimation/blob/master/src/TetrisNumbers.h

witnessmenow avatar Oct 30 '20 22:10 witnessmenow

A similar problem occurs on narrows (low height) matrix displays (I'm using 8 pixel height): The tiles start falling in invisible space, so there is a delay in every frame before a movement is visible. I patched the lib by (re-)setting the 'fallindex' to 8 instead of 0, so the tiles already start falling right at the edge of the display. But of course it would be ideal if the library could handle different matrix sizes.

altery avatar Mar 06 '21 00:03 altery

I have updated code to fix this issue into a new branch:

https://github.com/toblum/TetrisAnimation/tree/drop_default_Fix

Fix is only applied to the numbers so far. I'm dreading having to update all blocks in the alpha characters 😭

I have changed what was previously y_stop // y-position (1-16, where 16 is the last line of the matrix) where the brick should stop falling to be y_stop_offset // how many blocks above the bottom should this block stop and re-adjusted the maths for where the blocks land to be based on the drop distance. Basically anything that was a 16 before is now 0, 15 is now 1, 14 is 2 etc

I have also added the ability to set the drop distance when you are animating (which will help with your problem @altery )

tetris.drawNumbers(0, 48, false, 32);

  • 0 is still x position
  • 48 is still where the bottom should land
  • false is "draw colon"
  • 32 overrides TETRIS_Y_DROP_DEFAULT

So for you @altery , you could try set this to 8 and not have to modify the library. I'm not sure I'd be too interested in trying to handle different screen resolutions differently automatically, but i do like the idea of allowing the users to be able to control it.

witnessmenow avatar Jun 01 '21 21:06 witnessmenow

Fix now applied to text too, not yet merged into the main branch

witnessmenow avatar Jun 02 '21 08:06 witnessmenow