<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>iPhone Programming Tutorials &#187; iPhone Game Programming</title>
	<atom:link href="/tag/iphone-game-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://icodeblog.com</link>
	<description>iPhone Programming Tutorials</description>
	<lastBuildDate>Tue, 19 Nov 2013 19:34:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>iPhone Programming Tutorial: Animating A Game Sprite</title>
		<link>http://icodeblog.com/2009/07/24/iphone-programming-tutorial-animating-a-game-sprite/</link>
		<comments>http://icodeblog.com/2009/07/24/iphone-programming-tutorial-animating-a-game-sprite/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 17:52:15 +0000</pubDate>
		<dc:creator><![CDATA[brandontreb]]></dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Advanced]]></category>
		<category><![CDATA[iphone animation]]></category>
		<category><![CDATA[iPhone Coding]]></category>
		<category><![CDATA[iPhone Game Programming]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=1170</guid>
		<description><![CDATA[One thing I have noticed about many of the games in the app store is they lack animation. Of course, the huge companies like Sega and PopCap have some pretty amazing animation, but what about us indie iPhone game developers?

Well, Apple has made it quite simple to do animations. I really feel this method is often overlooked. I will show you in just a few lines of code, how to completely animate your game images. I will walk you through  ...]]></description>
				<content:encoded><![CDATA[<p>One thing I have noticed about many of the games in the app store is they lack animation. Of course, the huge companies like Sega and PopCap have some pretty amazing animation, but what about us indie iPhone game developers?</p>
<p><embed src="/wp-content/uploads/2009/07/RuyPunch1.mov" height="300" width="480" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></p>
<p>Well, Apple has made it quite simple to do animations. I really feel this method is often overlooked. I will show you in just a few lines of code, how to completely animate your game images. I will walk you through creating a simple application that uses animation. If you don&#8217;t care about creating the app and just want the animation code, <a href="#animation">you can skip to this step</a>.  We will be making an animation of Ryu throwing some punches.</p>
<h2>1. Create A View Based Application</h2>
<p>I&#8217;m not going to explain this one&#8230;</p>
<h2>2. Add These Images To Your Resources Folder</h2>
<p>Download<a href="/wp-content/uploads/2009/07/ryu1.zip">ryu.zip</a> and unzip it. Then drag the unzipped files into your <strong>Resources</strong> folder. Note: Sprite sheet downloaded from<a href="http://panelmonkey.org/"> http://panelmonkey.org/</a>. This file contains 12 images of Ryu from Street Fighter punching. It also has the background to Blanca&#8217;s stage just for fun.</p>
<h2>3. Create The Background</h2>
<p>You don&#8217;t have to do this step, it&#8217;s just to make it pretty.</p>
<p>Double click on <strong>whateveryoucalledyourapplicationViewController.xib</strong> to open it in Interface Builder. Click the arrow button on the view to rotate it. If you don&#8217;t what I am talking about, check out <a href="/2009/07/09/integrating-twitter-into-your-applications/">this post</a>.</p>
<p>Drag a UIImageView on to the screen and stretch it to fill the entire iPhone screen. In the Attributes inspector select <strong>sfst-blanka.jpg</strong>. Make sure mode is set to <strong>center</strong> as this image has very low resolution. It should look something like this (I have added a black background color).</p>
<p style="text-align: center;"><img class="size-full wp-image-1175 aligncenter" title="screenshot_01" src="/wp-content/uploads/2009/07/screenshot_0111.png" alt="screenshot_01" width="480" height="342" /></p>
<h2>4. Creating The Animation</h2>
<p><a name="#animation"></a></p>
<p>Open up <strong>yourApplicationViewController.m </strong>and add the following code to the <strong>viewDidLoad</strong> method.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;
	<span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span> imageArray  <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span>
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;1.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;2.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;3.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;4.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;5.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;6.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;7.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;8.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;9.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;10.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;11.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;12.png&quot;</span><span style="color: #002200;">&#93;</span>,
							<span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
	UIImageView <span style="color: #002200;">*</span> ryuJump <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>
		CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">100</span>, <span style="color: #2400d9;">125</span>, <span style="color: #2400d9;">150</span>, <span style="color: #2400d9;">130</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
	ryuJump.animationImages <span style="color: #002200;">=</span> imageArray;
	ryuJump.animationDuration <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.1</span>;
	ryuJump.contentMode <span style="color: #002200;">=</span> UIViewContentModeBottomLeft;
	<span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>ryuJump<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>ryuJump startAnimating<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>For all of you &#8220;1337&#8221; coders that are going to post in the comments telling me &#8220;Why don&#8217;t you use a for loop to load the images&#8221; (very nerdy voice): I am doing it like this, so it is obvious what is going on.  I want to show that you must populate the array with images.</p>
<p>So here is what is going on in this code:</p>
<p>We first create an array of <strong>UIImage</strong>s.  Next, we allocate our <strong>UIImageView</strong>.<strong> </strong>The next part is where the magic happens&#8230; Apple has given you a property of UIImageView that is an array of images.  The UIImageView class has a built in functionality to cycle through images at a given interval (hence animating them).</p>
<p>The next variable we see is the animation duration.  This is the number of seconds it takes to cycle through all of the images.  The default value for this is the number of images multiplied by 1/30.  This will give you a 30 fps frame rate.  Since we have 12 images and not 30, this duration would make our Ryu look like he was on crack.</p>
<p>In our case, the default would be 12 * (1/30) or .4 . We are going to slow this down significantly to 1.1.  Go ahead and play with this number when creating your animation.</p>
<p>The next variable is the <strong>contentMode</strong>.  The content mode determines how the image will fit inside the UIImageView frame.  Since our animation images vary in size, we just make the frame as large as the largest image and set the contentMode to UIViewContentModeBottomLeft.  What this means is, draw the image withough scaling and place it in the bottom left of the UIImageView.  Read up on contentMode to figure out what will be right for your applicaiton.</p>
<p>Finally, we just add the UIImageView to our main view and call the <strong>startAnimating </strong>method on it.  This will start the animation of these images.  There are also some other helpful methods you might use when doing animation.  They include <strong>stopAnimating</strong> and <strong>isAnimating</strong>.</p>
<h2>5. Make Sure The Device Starts In Landscape Mode</h2>
<p>In this example, we assumed that the device was in landscape mode.  Again, read <a href="../2009/07/09/integrating-twitter-into-your-applications/">this post</a> to see how to do this.  It involves adding<strong> Initial interface orientation</strong> to the info.plist file and adding this code to your viewController.m file.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>shouldAutorotateToInterfaceOrientation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIInterfaceOrientation<span style="color: #002200;">&#41;</span>interfaceOrientation <span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">// Return YES for supported orientations</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span>interfaceOrientation <span style="color: #002200;">==</span> UIInterfaceOrientationLandscapeLeft<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>That concludes our simple animation tutorial. Post a question or <a href="http://twitter.com/brandontreb">ask me on Twitter</a> if you need help.  You can download the source for this tutorial <a href="/wp-content/uploads/2009/07/AnimationApp1.zip">here</a>. Happy iCoding!</p>
]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/07/24/iphone-programming-tutorial-animating-a-game-sprite/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
<enclosure url="http://staging.icodeblog.com/wp-content/uploads/2009/07/RuyPunch1.mov" length="349110" type="video/quicktime" />
		</item>
		<item>
		<title>iPhone Game Programming Tutorial Part 2- User Interaction, Simple AI, Game Logic</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/</link>
		<comments>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 22:35:25 +0000</pubDate>
		<dc:creator><![CDATA[brandontreb]]></dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[iPhone Game Programming]]></category>
		<category><![CDATA[iphone game tutorial]]></category>
		<category><![CDATA[itennis]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=656</guid>
		<description><![CDATA[Ok folks, here it is. The next tutorial in our iPhone game programming tutorial (sorry for the delay).  Today, I will be discussing the basics of player interaction, simple game AI, and game logic.  We will also be exploring how to do simple collision detection so we know when the ball hits a paddle. Per popular request, I will be adding &#8220;Challenges&#8221; to the bottom of the tutorials from now on to give some more advanced ideas for  ...]]></description>
				<content:encoded><![CDATA[<p>Ok folks, here it is. The next tutorial in our iPhone game programming tutorial (sorry for the delay).  Today, I will be discussing the basics of player interaction, simple game AI, and game logic.  We will also be exploring how to do simple collision detection so we know when the ball hits a paddle. Per popular request, I will be adding &#8220;Challenges&#8221; to the bottom of the tutorials from now on to give some more advanced ideas for improvement. Let&#8217;s begin. Start by opening your code from part 1&#8230;</p>
<h3>User Interaction</h3>
<p>The first thing we will implement is user interaction.  All we really want to do is move the paddle&#8217;s X location to the X location of the touch from the user.  This will be a very simple implementation and could be much better (I will add this as a challenge at the bottom of the tutorial).  Open <strong>iTennisViewController.m </strong>and add the following code.</p>
<p style="text-align: center; "><a href="/wp-content/uploads/2009/02/screenshot_012.jpg"><img class="alignnone size-full wp-image-657" title="screenshot_01" src="/wp-content/uploads/2009/02/screenshot_012.jpg" alt="screenshot_01" width="442" height="218" /></a></p>
<p style="text-align: left; ">Just as we did in a previous tutorial, we are overriding the <strong>touchesMoved</strong> method.  This will detect when the user &#8220;drags&#8221; their finger on the screen.  First, I added the &#8220;else if&#8221; statement inside of <strong>touchesBegan</strong> that simply forwards all events to <strong>touchesMoved</strong> if the game is in a running state.</p>
<p style="text-align: left; ">The first 2 lines inside of <strong>touchesMoved </strong>simply detect the location of the user&#8217;s touch.  Next, we need to create a new CGPoint from the X location of the touch and the Y location of the yellow racquet (player racquet).  Objective-C won&#8217;t simply let us say racquet_yellow.center.x = location.x.  This is probably because CGPoint is immutable (not editable).</p>
<p style="text-align: left; ">Finally, the center of the player&#8217;s racquet is set to our new location.</p>
<h3>Collision Detection</h3>
<p>*Update, the user Naren has pointed out a much simpler collision detection.  The code has been updated to reflect it. Inside the gameLoop method of iTennisViewController.m add the following code</p>
<p style="text-align: center; "><span style="color: #0000ee; text-decoration: underline;"><a href="/wp-content/uploads/2009/02/picture-11.png"></a><a href="/wp-content/uploads/2009/02/screenshot_0111.jpg"><img class="alignnone size-full wp-image-677" title="screenshot_011" src="/wp-content/uploads/2009/02/screenshot_0111.jpg" alt="screenshot_011" width="370" height="175" /></a></span></p>
<p style="text-align: left; ">So, Apple has provided us with a very handy methods to check if to object frames collide.  Its called <strong>CGRectIntersectsRect.</strong>  We simply hand this method the frame of our ball and racquet.  When the ball collides with the racquet, we want to reverse its Y velocity.  The next if statement is required because sometimes we get in a state where the ball gets &#8220;trapped&#8221; on a paddle bouncing back and for and not going anywhere.  So, we want to ensure the ball&#8217;s velocity only gets reversed if it is front of each racquet. (Note, the NSlog is not needed, it was just for debugging)</p>
<h3>Simple Game AI</h3>
<p style="text-align: left; ">Next, we are going to discuss how simple AI can be added to allow a computer player to play iTennis with you.  Many of you might not know just how much is involved in a decent Artificial intelligence.  I could go on and on with nerdy math, philosophy, heuristics and the like, but I&#8217;m not.  I will show you some super NOOB, very easy to understand game AI.  Basically, the computer will &#8220;watch&#8221; the ball and move in the direction of it in hopes of hitting it.  Let&#8217;s get started&#8230; </p>
<p style="text-align: left; ">We first need to define a constant that will define how fast the computer player can move.  Add the following define to the top of iTennisViewController.m</p>
<p style="text-align: center; "><a href="/wp-content/uploads/2009/02/picture-21.png"><img class="alignnone size-full wp-image-660" title="picture-2" src="/wp-content/uploads/2009/02/picture-21.png" alt="picture-2" width="156" height="20" /></a></p>
<p style="text-align: left; ">As you start testing, you can adjust this number.  This is basically defining how fast the computer player can move in order to get to the ball.  The higher you make this number, the &#8220;better&#8221; the computer player will be.  You could actually make your computer unbeatable if this number were high enough.  Now, add the following code right under your collision detection code:</p>
<p style="text-align: center; "><a href="/wp-content/uploads/2009/02/picture-31.png"><img class="alignnone size-full wp-image-661" title="picture-3" src="/wp-content/uploads/2009/02/picture-31.png" alt="picture-3" width="663" height="174" /></a></p>
<p style="text-align: left; ">The first &#8220;if&#8221; statement is to add some difficulty for the computer.  It basically checks to see if the ball is on &#8220;his&#8221; side of the court.  The computer will not move or respond to the ball unless it&#8217;s on his side.  It could be omitted, but makes for a more interesting game.  The next if statements check to see if the X coordinates of the center of the ball are different than the X coordinates of the center of the racquet.  If the ball is to the right of the computer&#8217;s racquet, the X coordinate of the computer&#8217;s racquet is increased by <strong>kCompMoveSpeed</strong>. If the ball is to the left of the computer&#8217;s racquet, the X coordinate of the computer&#8217;s racquet is decreased by <strong>kCompMoveSpeed. </strong></p>
<p style="text-align: left; ">It should now be clear how adjusting the kCompMoveSpeed variable, will affect the computer&#8217;s performance&#8230;</p>
<p style="text-align: left; ">Now, you can actually hit Build and Go to see the game in action.  As you can see the computer responds to the ball and hits it most of the time.  There is still one last piece to make the game fun. Scoring!</p>
<h3>Game Mechanics: Scoring</h3>
<p style="text-align: left; ">Now, we need a way to keep score.  This is actually some more simple collision detection.  We are basically checking to see if the ball collides with the back walls.  First, let&#8217;s define a few variables and a method.  Open up iTennisViewController.h.  Add the following highlighted code:</p>
<p style="text-align: center; "><a href="/wp-content/uploads/2009/02/picture-41.png"><img class="alignnone size-full wp-image-662" title="picture-4" src="/wp-content/uploads/2009/02/picture-41.png" alt="picture-4" width="398" height="450" /></a></p>
<p style="text-align: left; ">We need integer representations of the score so we can add points when the player and the computer score.  Also, we will need a function called reset that will be called to reset the ball to the center of the screen.  Now we need to define one more variable.  Add the following line to your defines at the top of iTennisViewController.m</p>
<p style="text-align: center; "><a href="/wp-content/uploads/2009/02/picture-51.png"><img class="alignnone size-full wp-image-663" title="picture-5" src="/wp-content/uploads/2009/02/picture-51.png" alt="picture-5" width="132" height="18" /></a></p>
<p style="text-align: left; ">This variable is pretty self explanatory, but in case you didn&#8217;t catch on, it defines the amount of points needed to win.  I just made it 5 for a quick game.  Now, let&#8217;s check to see if a player or computer scored.  Right after your AI code, add the following code:</p>
<p style="text-align: center; "><a href="/wp-content/uploads/2009/02/picture-61.png"><img class="alignnone size-full wp-image-664" title="picture-6" src="/wp-content/uploads/2009/02/picture-61.png" alt="picture-6" width="346" height="150" /></a></p>
<p style="text-align: left; ">Ok, first we see 2 if statements.  The are basically checking to see if the ball has hit/passed the top or bottom of the screen.  If it passes the top, the player score gets incremented.  If it passes the bottom, the computer score gets incremented.  The next line contains a little bit of fanciness if you are new to programming.  We are calling the reset function, but what is that expression we are passing to it? </p>
<p style="text-align: left; ">Well, if you look at the definition of reset, it takes a BOOL value that determines if the game is over.  So this can either be true or false.  We are simply passing true or false when the expression is evaluated.  So, (player_score_value &gt;= kScoreToWin) will evaluate to false when the player_score_value variable is less than 5.  Once this variable reaches 5, it will return true and pass it into the reset function.</p>
<p style="text-align: left; ">Why do this? Well it saves us lines of code and complexity.  So now you don&#8217;t have to do if(player_score_value &gt;= kScoreToWin) ) [self reset:YES]; }else{[self reset:NO];} . make sense?</p>
<p style="text-align: left; ">Now, let&#8217;s define the reset function. Add the following method to iTennisViewController.m</p>
<p style="text-align: center; "><a href="/wp-content/uploads/2009/02/picture-71.png"><img class="alignnone size-full wp-image-665" title="picture-7" src="/wp-content/uploads/2009/02/picture-71.png" alt="picture-7" width="496" height="272" /></a></p>
<p style="text-align: left; ">The first thing we do is pause the game.  Remember pausing the game causes the &#8220;Tap to Begin&#8221; Message to Display. Next, we center the ball on the screen.  If YES/true was passed in for the newGame variable, we need to do a few things.  First, we check who won by comparing the computer and player scores.  Next, we update the &#8220;tapToBegin&#8221; message to notify the player who won.  You could add another label for this, but I am just recycling this one&#8230; Finally, we reset the player and computer scores to 0 because a new game is starting.</p>
<p style="text-align: left; ">If it is not a new game, we need to reset the tapToBegin message to display &#8220;tapToBegin&#8221;.  This has to be done in case the message was altered to say &#8220;Player/Computer wins!&#8221;. Finally, we update the labels on the screen to reflect the new scores.  Now you should be good to go&#8230;</p>
<p style="text-align: left; ">Click Build and Go and battle the computer in an epic game of iTennis!  If you have any comments or questions, leave them here or <a href="http://twitter.com/brandontreb">ask me on Twitter</a>.  You can also download the source for this tutorial <a href="/wp-content/uploads/2009/02/itennis-22.zip"></a><a href="/wp-content/uploads/2009/02/itennis-211.zip">here</a></p>
<h3>As Promised, Here are some challenges</h3>
<ul>
<li>Improve on user interaction &#8211; Make it so when the user taps, the racquet moves towards the tap rather than moves directly to the tap location</li>
<li>Improve collision detection &#8211; When the ball hits the paddle, use some simple physics to make the speed of the paddle affect the speed (and direction) of the ball</li>
<li>Improve on the AI &#8211; add some randomness to your AI, make it attempt to &#8220;predict&#8221; where the ball is going to be</li>
<li>Improve Scoring &#8211; Make it used tennis scores 15, 30 , etc&#8230;</li>
<li>Improve scoring &#8211; Make it so you must win by 2 points</li>
</ul>
<p style="text-align: left; ">Stay tuned for the next tutorial when I will be going over game audio, splash screen, about, and some other polishing&#8230; Happy iCoding!</p>
]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/feed/</wfw:commentRss>
		<slash:comments>163</slash:comments>
		</item>
	</channel>
</rss>
