The board green with black border separating the squares
Tile-Based Fundamentals 271
Even though the sample map editor doesn’t do much, it does illustrate important points about all map edi-tors. Just about every map editor I’ve made or used includes something similar to the map panel and some-thing similar to the tile panel (although usually with a more obvious way of scrolling through the tileset).
A Tile-Based Example: Reversi
the beginning of play
TeamLRN
Designing Reversi
I have Milton Bradley’s Othello sitting on my game shelf, so I looked to that to model this game. The board is green with a black border separating the squares. Two cells in from the corners, there is a small square on the junction of the black lines, apparently to separate the sides and corners from the middle of the board. The pieces are double-sided and two-colored, with white on one side and black on the other.
274 Isometric Game Programming with DirectX 7.0
The first row of tiles is the nonhighlighted version of a board background tile. The second row is the highlighted version. Rows three through five are the animation sequence for the piece flip, with the actual pieces for both sides on opposite ends of the sequence. The last row consists of extra graphics I needed to finish up the UI. There is a red square to represent the last move made, and four icons to show the AI level chosen for the players.
const int AI_RANDOM=1;
const int AI_GREEDY=2;
Level Tactic
AI_HUMAN None.Waits for input from the mouse.
AI_COUNT is not an AI level, but rather a constant to keep
track of the number of levels that exist, in case you later want
Game States
As with all games, there are a number of major game states in which
Reversi might dwell at any given time. I was able to reduce it to only
five states.
//game states
const int GS_NONE=-1;
const int GS_WAITFORINPUT=0;
const int GS_NEWGAME=1;
const int GS_NEXTPLAYER=2;
const int GS_FLIP=3;
|
|
---|