Tetris Style Spawning

I’m looking for a code to spawn in a Tetris style, meaning I don’t want 2 sprites to spawn at the same time, I also want the spawning to be random. The sprite animation already moves how I want so I don’t need to translate after spawning.

I assume I could make a table with all the pieces (like; red, green, blue, yellow). Then tell the spawning code to take random pieces from that table. There will be 5 spawn points.

I want to control the speed in which this all takes place. If the player presses a button I want the sprite’s animation and the spawning to increase in speed.

Another note, after the sprite’s animation it will transform into another corresponding sprite (of red, green, blue, or yellow).

I’m new and this is the most complicated code I’ve tried to develop. Any help is greatly appreciated. [import]uid: 77916 topic_id: 12770 reply_id: 312770[/import]

Why are you using sprites and not just: display.newImage(“filepath”) ?

To make a random number you should use:

math.random( lowestNumber, highestNumber) [import]uid: 24111 topic_id: 12770 reply_id: 46832[/import]

I’m using sprites because I’m animating something going down a path. for example some one walking toward the camera after being spawned.

thanks for the response by the way, it’s going to help me a lot. [import]uid: 77916 topic_id: 12770 reply_id: 46842[/import]