Tom Ortega II

Archive for October, 2008|Monthly archive page

Building Games with Flex: Tic-Tac-Toe V1 Code Explained Pt 2

In Flash*Flex*AS, Game Programming, Programming, Technology and Software, Video Games on October 3, 2008 at 8:24 am

In my last post, I explained my logic/thinking behind 2 of the 3 files that make up Tic-Tac-Toe V1: Main.mxml and GamePiece.mxmlClick here to play the game (right click to view/download the source).  In this post, I’ll breakdown the remaining piece.

This piece is the real workhorse of the game.  It houses not only the board where the pieces are laid out, but also the game logic itself.

Was that the best decision?

Probably not.  If I wanted to swap out the game rules but keep the same pieces, I couldn’t do that.  It’s not so common with Tic-Tac-Toe, but think of a card game.  One deck of 52 cards can play an almost infinite number of games.  Would it make much sense to put the Solitaire logic right inside the CardDeck class file?  Nope, it surely wouldn’t.  I was in a hurry though so I did. Read the rest of this entry »