Computer Science Canada

Ok, i did some of it (tetris) but im stuck

Author:  ak [ Mon Apr 21, 2003 5:01 pm ]
Post subject:  Ok, i did some of it (tetris) but im stuck

I got to the point where i can randomize the blocks 2 fall down but now i need to get them to dissapear when they form a line. How do I do that? \[/quote]

Author:  Tony [ Mon Apr 21, 2003 5:26 pm ]
Post subject: 

well assuming you're using a 2D array to store your blocks, all you have to do to remove a full line is to move all the lines above it down 1 step.


if line(x) is full

for i: x to maxline - 1
line(i) := line(i+1)
end for

end if

something like above. Ofcourse you'd need to have 2 forloops to move the lines down since you'll be doing it block by block.