| To make a game out of this we need to create a "paddle". Create a new Layer called Paddle and draw a rectangle on it. Convert it to a movie clip object called paddle. | ||
The player needs to move the paddle left and right so that the ball will bounce of it.
Highlight the paddle and add the following code in it's Action Window
onClipEvent (load) {
this._x = 275;
this._y = 350;
paddle_speed = 10;
}
|
||
|
Next we need to move the paddle if the player presses a key. We will use the
right arrow key to move the paddle right and the left arrow key to move it left.
Enter the following code in the onClipEvent (enterFrame); function.
if ( Key.isDown(Key.RIGHT) ){
this._x+= paddle_speed;
} else if ( Key.isDown(Key.LEFT) ){
this._x-= paddle_speed;
}
|
||