First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Oscar Gálvez

(All the actions will be explained at the end of the tutorial)

Here we will learn how to make an arkanoid game in my way. First, we will make the ship then, the ball (remember to make them movie clips and name the ball in the instance). Now we will create a movie clip that will not be seen on the screen, make it the shape that you want and name it “line” in the instance. Make a double click on it an make another movie clip into it. Now, make double click again on the movie clip and write the next on the frame actions:

tellTarget (_root._root.ball) {
    _x -= 10;
    _y -= 10;}

this will make that the ball gets in way to the northwest. Now make another frame and write; gotoAndPlay (1),this will make that the movement repeats constantly. Now make a double click out of the clip and write in the frame actions : stop ();,now make another frame (2nd) and make another movie clip in this second frame into the first movie clip we had already done (not the last one). Make a double click on it an write on the frame actions the next:

 tellTarget (_root._root.ball) {
    _x -= 10;
    _y += 10;}

This will make the ball gets in way to the southwest. Make another frame in this movie clip, an write: gotoAndPlay (1);.make double click out of the movie clip and make another frame (3rd) , then make another movie clip and repeat the same process (rememer to write: stop ();)but in this one you will write:

 tellTarget (_root._root.ball) {
    _x += 10;
    _y -= 10;}

to get northeast position. Repeat the same and in the next frame (4th) you will make the same but in the frame actions of the movie clip you will write:

 tellTarget (_root._root.ball) {
    _x += 10;
    _y += 10;}

to get southeast position. Now make a double click out and write: stop();on the frame actions. Make another double click out to get in the movie. Now we will get into the ship, make double click on it. In there make an invisible movie clip (if you don´t know how to make transparent colours just select the colour you want and make a click on the mixer icon an there write 0% in the alpha) with a rectangle shape and there write the next:

onClipEvent (enterFrame) {
    if (this.hitTest(_root._root.ball)) {
        _root._root.line.gotoAndPlay(2);
    } else {
    }
}

The number of the frame depends on the way you want the ball to go ( the frame number is of the movie clip we were working on) . I recommend to copy this movie clip, paste it next to the other one and to write in the actions another frame number for the ball to get in two different directions.

Now make the walls and write:

onClipEvent (enterFrame) {
    if (this.hitTest(_root.ball)) {
        _root.line.gotoAndPlay(3);
    } else {
    }
}

depending on the frame number of the direction of the ball. Now, we will make the blocks that will be destroyed by the ball.

Make a block with the shape you want, make a double click to enter in the movie clip and write a stop (); in the first frame, make another frame which will have no drawing, and write stop (); again in the frame actions. Now make double click out of the movie clip and write the next actions for the movie clip:

onClipEvent (enterFrame) {
    if (this.hitTest(_root.ball)) {
        _root.line.gotoAndPlay(4);
        gotoAndPlay (2);
    } else {
    }
}

Remember that the frame number of the “line” can be the way you want, but the frame number that appears beneath it cannot be changed because it says that the movie clip will go to its second frame, where it is nothing, this is the frame where it will go when the ball hits the block. Now write the next actions on the ship:

 onClipEvent (keyDown) {
    if (Key.isDown(key.LEFT)) {
        _x -= 7;
    }
}
onClipEvent (keyDown) {
    if (Key.isDown(key.RIGHT)) {
        _x +=7;
    }
}

This will allow you to move the ship. And the number 7 indicates the number of pixels it will advance. Now you can make the ball to go any direction you want and to make the walls that you want and make the game more complex.

This is the explanation some of the actions:

_root.

is a very useful action that means that the movie clip you are referring is out of the movie clip you actually are.

tellTarget (  ) {
}

means that you want another movie clip to make something when you want it.

» Level Intermediate

Added: 2002-05-30
Rating: 4 Votes: 197
(10 being the highest)
» Author
here is shown how to make the arkanoid game in an easy way.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: doc_chin7
» Description:

The flash's horizontal road drive was done in CS4 and was upgraded to CS6. The car responds to right/ left key and flash will auto-generate the movement of roads from left-right or right-left based on random number. Have fun driving in this virtual environment and avoid other cars... :) If you are creative, a road driving game can be created from it.

Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.