— andreluizgollo
I have been working on a tetris clone for a while too... I have been trying to copy the way the old iphone Tris game worked (before EA killed it long ago) - it was by far my favorite tetris game. I had it on my phone up until not too long ago when it finally was no longer compatible with iOS. I really liked how smoothly the pieces moved...
you can drag a piece left or right, up or down, a swiping motion down will drop the piece. a tap rotates the piece.
it has been difficult to duplicate the feel, but I think I am getting close. What I do is track how far a touch has moved from the initial point, and how many ticks it has been in touch. when the touch ends, if it has moved less than a minimum threshold, and for less than a set number of ticks, it considers that a tap and tries to rotate. If the touch moved more than a certain threshold down, but not horizontally, and for less than 15 ticks, then it considers that a swipe down and drops the piece to the bottom.
that way there is no delay in moving the piece... you start moving the piece right away, and decide later if it was a tap or swipe.
you can try my version here: (although it is still really buggy). https://www.rieperts.com/games/tetris/
one of the problems is that I don't have the piece drift to be aligned to a column when you stop dragging yet. if it can't move it snaps into place before it locks the piece down... I had it rounding off to the nearest column, but if it was less than half way to a column it would snap back and that didn't look right so that is turned off in this version.
if you drag too long the movement gets weird, and right now, it doesn't limit how long you can drag it upwards, and this version never speeds up...
I was also testing particles - other interface things that only partially work so it isn't ready for anything other than proof of concept, lol :)
oh, if you are playing with keyboard and mouse, the pause and restart buttons don't do anything (they do with touch). But you can press "P" to pause, or press space bar to restart...