Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Ok, i did some of it (tetris) but im stuck
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ak




PostPosted: 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]
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Apr 21, 2003 5:26 pm   Post subject: (No 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.

code:

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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: