tetris problem

BlitzPlus Forums/BlitzPlus Programming/tetris problem

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

What I did was, I set up an array like Playfield(x,y), where x and y is the number of blocks horizontal and vertical. And then when a block has reached a point where it can't move any further then I put values into the above array and I have a rutine that draws the playfield all the time reading the array and using the stored numbers as a pointer for which block to draw from the loaded anim-image.

[code]
for y = 0 to 19
for x = 0 to 11
drawimage blocks,xoffset+x*16,yoffset+y*16,playfield(x,y)
next
next
[\code]

The offset variables are set to the x and y coordinate where your playfield begins.

Also I have a rutine that goes through the playfield and checks for completed lines and if it finds any then it moves the blocks above it down and add to the score.

I hope that helps.