• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 25. Storyboarding to Finished Project > Second-Player Functionality

Second-Player Functionality

The various angles in each player’s tank, controls, and fire button made it impractical to frequently copy code from one player to another. And because it wasn’t practical to make every change twice, I waited until this point to create the functionality for the second player. When and how to integrate two sets of code, and when to keep them separate, is a question whose answer is likely to change as your project progresses.

Player 2’s Tank Movement

First I copied the code from the player1tank movie clip onto the player2tank movie clip. Then on the player2tank movie clip, I replaced all instances of player1target and player1controls with player2target and player2controls. I changed the if statement that determines which way to rotate the tank so that it evaluates to true if the result is less than 180 instead of greater than 180:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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