Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
96 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 Stepping to the
 plate...

 Mr. Structure
 The New Shape
 Maker

 Update takes a few
 practice swings

 Let's Get Moving!
 Time to Clear the
 Bases?

 The Final Batters
 The Loop and His
 Team

 Until Next Time...

 Printable version

 


  The Series

 Part 1
 Part 2
 Part 3
 Part 4
 Part 5
 Part 6

 

Time to Clear the Bases?

When it comes time to clear the grid we call upon Line_Test. This will function will return TRUE if it clears a line. It will return false if it doesn't have a valid line on the grid.

Here is the code for it:

Popup : Source Listing 6

The code loops through every line in our grid memory and test for blocks. If it finds that a grid location is empty then it continues with the next line. If every location has a valid block inside of it, then the function moves all of the memory above it to the row that had the line. It does this by calling the Win32 API function RTLMoveMemory().

We have it return after every valid line it finds, and eliminates, because when we want to keep score it will be easier to track how many lines they earn. It is always a good thing to keep future expansion in mind while programming.



Next : The Final Batters