Games [XUI2D] Tetris

Erel

B4X founder
Staff member
Licensed User
Longtime User


I've ported the old Tetris example (https://www.b4x.com/android/forum/threads/demo-cross-platform-tetris-clone.94146/#content) to X2 framework.

It is part of the examples pack.

This game is different than other games as there is nothing physical in this game.
Each "piece" is made of 4 blocks. Each block is a body by itself. There is always one moving piece.
The size of each block is 1 x 1 meters.
The world size is set in such way that the number of pixels (scaled pixels actually) per 1 meter is a whole number. This is important to avoid drawing issues.

The user input is checked every set interval (IntervalBetweenUserInputMs).
The bodies are moved in a non-physical way using SetTransform.

The main difference compared to the old example is that we don't need to manage the elements positions ourselves. It is done by the X2 framework.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…