Game Development Reference
In-Depth Information
'We use drag and drop for player moves.
AllowDrop = True
'Bold looks nicer.
Me.Font = New System.Drawing.Font("Arial", 9, FontStyle.Bold)
End Sub
Again, we are laying groundwork for implementing player moves in the future
using drag and drop. Since our class is in all respects a button, we let the code that
creates instances of our class manipulate them as though it were a button.
Implementing Game State
We will implement the state data using a class. The code for that class will color
the squares and compute the rank of the board. We will also have it mark the
buttons on the board when we ask it to. We would normally pull that kind of
functionality out of the class, but we will take the expedient route here. Before we
can implement the class, we need some helper code.
Constants
Add a module to the project and name it Constants.vb. Add the Public keyword
to the module declaration.
Public Module Constants
We will keep more than just constants in this file, but we will start with the
constants. Add the following code:
'UNREACHABLE has to be bigger than any possible count.
Public Const UNREACHABLE As Integer = 64
'And TRAPPED needs to be bigger than that.
Public Const TRAPPED As Integer = 127
We use UNREACHABLE as our dividing line between when the fox can and cannot
reach freedom. We use TRAPPED to denote the fox has lost. We also will add the
per-square data definitions to this module.
'The raw data needed to process a square.
Public Class SquareData
Public Holds As Checker
Public Kind As SquareColor
Public Steps As Integer
End Class
 
 
Search Nedrilad ::




Custom Search