Hello, I've been searching for tutorials and doing trial and error the past few days but I havent gotten anywhere so I figured I'd ask here. What i'm trying to do is a simple tetris-like movement on a grid (6x8) where a block spawns and falls slowly, and you can place them.
Like such:

At first I thought about doing hitTests on each block, but that seems like it would function less properly in the long run. My two problems are:

How exactly can I set up a tile-based grid in an array which I can use for block movement/collisions/detection.

and how can I set up an Interval (using SetInterval() I suppose) that creates instance after instance of a random block type?

I'm still a beginner and any leads would be helpful.