Spawning new Tetris blocks

How do I…

I’m trying to spawn Tetris Blocks, but don’t know how to do it.

What is the expected result

That a new block is created, and that it should move down like the first.

What is the actual result

The 2nd Block freezes in place.

Related screenshots

Any info on how to do it?

Firstly, give your sprites meaningful names. Because this is a bit of a guessing game.

I’m assuming NewSprite3 is the base of the playing area, and NewSprite2 is the Tetris playing blocks. If so, you’ll want to create a new block when NewSprite2 and NewSprite3 are in collision. And you’ll want to only move the block that’s falling down. My example below uses a boolean variable for this.

I’ve also used a scene boolean variable “createBlock” to control when a new block is created.

1 Like

Ok, so I did the same code as yours, but mine freezes in place, and I really dont know how to fix it.

You’ve got the wrong condition here:

image


And get rid of the unnecessary trigger once in the event before the highlighted one. The variable gets changed, so the condition will be false the next game frame. Only use trigger once when it’s really needed.

1 Like

Ok, thank you for helping! I didn’t catch myself on that!