Hobbies And Interests

How to Build a Flash Rocket Game in CS5

"Adobe Flash CS 5" is a powerful animation tool that can be used to create video games. Creating a rocket game is no different than a number of possible projects you can create with Flash. Once you have a basic foundation for this type of game, you can move on to all kinds of more advanced projects. The object of this particular rocket game will be to find a coin, or other collectible object, hidden somewhere in the level.

Instructions

  1. Create the Rocket and the Coin

    • 1

      Open Flash. Under the middle column "Create New," click on the "ActionScript 2.0" option.

    • 2

      Use the tools located on the left side of the screen to create a rocket. Its design is completely up to you. When you're finished, press "Ctrl+A," then "F8." A small window will pop up asking you to name your new symbol. Type "mcMain" into the "Name:" box and press "OK."

    • 3

      Click on your rocket to select it. Find the "Properties" tab, located on the right side of the screen by default. At the top of the tab, there is a white box that reads "<Instance Name>." Click on it to empty the box and type "mcMain" in its place.

    • 4

      Find the "Timeline" tab, by default located at the bottom of the screen, and click on the first small white box underneath the number "1." Then press "F9." Copy (Ctrl+C) and paste (Ctrl+V) the following code into the empty window that pops up:

      var mainSpeed:Number = 7; //The speed of the character
      var mainScore:Number = 0;
      onEnterFrame = function(){ //this function will run every frame (needed for moving the character
      if(Key.isDown(37) || Key.isDown(65)){ //if the "A" key or Left Arrow Key is Down
      mcMain._x -= mainSpeed;//then the move the guy left
      } else if(Key.isDown(39) || Key.isDown(68)){//if the "D" key or Right Arrow Key is Down
      mcMain._x += mainSpeed; //then move the guy to the right
      } else if(Key.isDown(40) || Key.isDown(83)){//if the "S" key or Down Arrow Key is Down
      mcMain._y += mainSpeed; //then move the guy down
      } else if(Key.isDown(38) || Key.isDown(87)){//if the "W" key or Up Arrow Key is Down
      mcMain._y -= mainSpeed; //then move the guy up
      }
      }
      mcCoin.onEnterFrame = function(){
      if(mcCoin.hitTest(_root.mcMain)){
      mainScore += 100;
      this.swapDepths(999);
      this.removeMovieClip();
      trace(mainScore);
      }
      }

    • 5

      Use the tools on the left of the screen to create a coin. It doesn't even have to be a coin, just an object that you want your players to collect in order to complete the game. Once you're finished, press "V," click and drag over your collectible object and then press "F8." Name your symbol "mcCoin."

    Create the Level

    • 6

      Click the "Timeline" tab. Right click the "Layer 1" box on the left side and choose "Insert Layer." A new box called "Layer 2" will be added above "Layer 1."

    • 7

      Click and drag "Layer 2" so it sits underneath "Layer 1."

    • 8

      Use the paintbrush and shape tools on the left side of the Flash window to paint a background for your rocket game. It can look however you want it to, and the size does not matter.

    • 9

      Press "V" and click on your collectible object. Drag it somewhere on the screen with your mouse. Wherever you put it is where players will have to move the rocket to collect it, the harder the coin is to find, the more challenging the game is. Once you're finished, press "Ctrl+Enter" to play your game.


https://www.htfbw.com © Hobbies And Interests