- XNA 4.0 Game Development by Example: Beginner's Guide
- Kurt Jaegers
- 194字
- 2021-04-13 16:52:07
Given a square to fill, FillFromAbove()
looks at the piece directly above to see if it is marked as Empty
. If it is, the method will subtract one from rowLookup
and start over until it reaches the top of the board. If no non-empty pieces are found when the top of the board is reached, the method does nothing and exits.
When a non-empty piece is found, it is copied to the destination square, and the copied piece is changed to an empty piece. The rowLookup
variable is set to -1
to ensure that the loop does not continue to run.