Making tetrominoes fall

One major feature still lacking in this prototype is the gravity that makes tetrominoes fall down at a given interval of time. With the main engine already developed and working, it's just a matter of adding a timer listener and doing the same thing as the player presses DOWN arrow key.

The idea: After a given amount of time, make the tetromino controlled by the player move down by one line.

The development: First, add a new class level variable.

private const TS:uint=24; private var fieldArray:Array; private var fieldSprite:Sprite; private var tetrominoes:Array = new Array(); private var colors:Array=new Array(); private var tetromino:Sprite; private var currentTetromino:uint; private var currentRotation:uint; private ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.