toblum / TetrisAnimation

Library to draw numbers on a LED matrix in a tetris style
GNU General Public License v3.0
125 stars 21 forks source link

Led matrix 64x64 Fall problems #11

Open betojsp opened 4 years ago

betojsp commented 4 years ago

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 ?

toblum commented 4 years ago

HI @betojsp,

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

witnessmenow commented 4 years ago

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, notifications@github.com 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 .

betojsp commented 4 years ago

TETRIS_Y_DROP_DEFAULT = 30

30

TETRIS_Y_DROP_DEFAULT = 8

8

witnessmenow commented 4 years ago

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

altery commented 3 years ago

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.

witnessmenow commented 3 years ago

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);

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 commented 3 years ago

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