• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Game Code

Wow—think of all the information needed to get to this point. You have learned about multiplayer servers, a little bit about networking, how to create a chat, and the basics of multiplayer gaming in Flash. After all that, this section should be a breeze! We'll discuss the code needed to start a game of tic-tac-toe, restart the game, and detect if the game is over and who (if anyone) won—all of which is pretty basic.

As mentioned in the last section, in tic-tac-toe there are nine tiles on the screen, one for each possible move, or space. There is also a movie clip with an instance name of popup. This movie clip contains four keyframes. The first one is blank. The next, labeled Game Started, is displayed when a game first starts; it informs the player that the game is under way and whose turn it is. The next keyframe is labeled Game Over. When the game has finished, this frame is displayed. It can display any of three messages: “You won!,” “You lost!,” or “Game over. There is no winner.” The final keyframe is labeled Player Left. This frame appears when your opponent leaves the game (either by leaving the room or by leaving the chat).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint