tetris problem

BlitzPlus Forums/BlitzPlus Programming/tetris problem

i was a bit bored so i decided to make a wee tetris game but i'm stuck as how to produce all the blocks. i thought about copying the one image about 170 times and storing it in an array but this seems VERY wasteful of memory. is there a better way?

When I made mine, I made one square graphic and then made a set of offset coordinates for each block that was used by the drawing rutine.

I kept all of my shapes in a 4*4 array

sorry, didn't explain very well. i mean the stationary blocks, the ones that have fallen. in my tetris, my shapes are made from 4 16x16 blocks.i don't mind copying the same image 4 times for the falling blocks but when they land i need to copy another 4 image each times one shape falls and i'm am left with about 130 copies of the same image.

What i wanna know is there any way to draw multiple copies of the same image without copying it?

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.