<html>
<head>
<title>PH: Flash Tutorials</title>
</head>
<body bgcolor = "#FFFFFF">

<A HREF="tutorial.html#Tips">Tips</A>
&nbsp;&nbsp;&nbsp;
<A HREF="tutorial.html#Begin">Beginners</A>
&nbsp;&nbsp;&nbsp;
<A HREF="tutorial.html#Inter">Intermediate</A>
&nbsp;&nbsp;&nbsp;
<A HREF="tutorial.html#Adv">Advanced</A>
&nbsp;&nbsp;&nbsp;
<A HREF="tutorial.html#Resource">Resources</A>
&nbsp;&nbsp;&nbsp;
<A HREF="mailto:phonsie@maths.tcd.ie">E-mail me</A>
		
<a name =Breakout>
<h2>Arkanoid/Breakout</h2>
Part 3: 
<!-- <A HREF="#TOP">Back to top</a>-->
<table border = 1>
<tr>
	<td colspan = 2>
	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. 
	<td>
</tr>
<tr>
	<td colspan = 2>
		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
		<dir>
		<pre>
		onClipEvent (load) {
	
			this._x = 275;
			this._y = 350;
			paddle_speed = 10;
		}
	
		</pre>
		</dir>
		This puts the paddle in an initial position.
	</td>
</tr>
<tr>
	<td colspan = 2>
		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.
		<br>	
		Enter the following code in the onClipEvent (enterFrame); function.
		<dir>
		<pre>
			if ( Key.isDown(Key.RIGHT) ){
				this._x+= paddle_speed;
			} else if ( Key.isDown(Key.LEFT) ){
				this._x-= paddle_speed;
			}	
		</pre>
		</dir>
		You should now have a <a href="ball4.swf">moveable paddle</A> on the screen along with the ball.
		Move the paddle using the right and left arrow key. What's wrong with this ?? 
		<p>
	</td>
</tr>
</table>	

<A HREF="#TOP">Back to top</a>&nbsp;&nbsp;&nbsp; <A HREF="breakout3.html">Next</A>
</body>
</html>

