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

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.

GameBoard.mxml
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. Continue reading “Building Games with Flex: Tic-Tac-Toe V1 Code Explained Pt 2”

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

Part of my goals with these posts is teaching Flex for those just getting started.  What better way to learn Flex than by building a game of Tic-Tac-Toe.  Code is code and lessons can be learned/shared despite the final output.  You’ll (hopefully) learn tricks and methodologies for helping you code non-game projects via the code that I share and explain in this series.

There are  3 files that make up the complete game (right click to view/download the source) :

  1. Main.mxml – This has the Application tag
  2. GamePiece.mxml – This is the X/O game piece
  3. GameBoard.mxml – This is the tic-tac-toe gameboard

I’ll go over the 3 files, explaining logic on why/what from both the Flex and gaming perspective. Continue reading “Building Games with Flex: Tic-Tac-Toe V1 Code Explained Pt 1”

Gaming: Playing both sides

Being an OG – Original Gamer

For as long as I can remember, I’ve gamed (specifically the video kind).  Before I got married, I spent almost every birthday I can remember at Chuck E. Cheese’s (even my 21st!)  To me, birthday equated to gaming.  In addition to those special days, I have a lot of memories in life associated with gaming:

  • When I was 6 or 7,  I remember me and my dad going to our frequent hangout, an arcade down the street.  It was actually a miniature golf course, but we never did anything but game.  We’d play Vanguard together.  As you can see by this image, it had this unique setup.  It was one of the first games I can remember that had multiple buttons.  My dad would drive (use the control stick) while I sat shotgun (took control of the 4 direction shoot buttons).  Oddly, I think this contributed to my sense of it being okay to take the back seat for the greater good.  As long as the team wins, it doesn’t matter which position you play.
  • Continue reading “Gaming: Playing both sides”