<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: iPhone Game Programming Tutorial Part 2- User Interaction, Simple AI, Game Logic</title>
	<atom:link href="/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/feed/" rel="self" type="application/rss+xml" />
	<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/</link>
	<description>iPhone Programming Tutorials</description>
	<lastBuildDate>Fri, 16 Aug 2013 22:23:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
	<item>
		<title>By: trolol</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-9576</link>
		<dc:creator>trolol</dc:creator>
		<pubDate>Sun, 02 Dec 2012 04:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-9576</guid>
		<description><![CDATA[I am having trouble figuring out how to make the Tap to Begin label go away once I start the game. Wondering what part of the code i need to fix? i&#039;m new to programming so i&#039;m still learning the basics and trying to figure out stuff]]></description>
		<content:encoded><![CDATA[<p>I am having trouble figuring out how to make the Tap to Begin label go away once I start the game. Wondering what part of the code i need to fix? i&#8217;m new to programming so i&#8217;m still learning the basics and trying to figure out stuff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Appsdeveloper2</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-9189</link>
		<dc:creator>Appsdeveloper2</dc:creator>
		<pubDate>Sun, 05 Feb 2012 18:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-9189</guid>
		<description><![CDATA[Very useful post. Thanks a lot.]]></description>
		<content:encoded><![CDATA[<p>Very useful post. Thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asda</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-9048</link>
		<dc:creator>Asda</dc:creator>
		<pubDate>Fri, 23 Dec 2011 23:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-9048</guid>
		<description><![CDATA[This was happening to me, and I had to fix my timer. Check your NSTimer letter for letter with his.]]></description>
		<content:encoded><![CDATA[<p>This was happening to me, and I had to fix my timer. Check your NSTimer letter for letter with his.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samrat Mazumdar</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-8205</link>
		<dc:creator>Samrat Mazumdar</dc:creator>
		<pubDate>Mon, 10 Oct 2011 02:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-8205</guid>
		<description><![CDATA[I want to keep a cross icon on iTennisViewController.xib and make it a UIButton and when it is pressed it will comeout of the game. How to do that?]]></description>
		<content:encoded><![CDATA[<p>I want to keep a cross icon on iTennisViewController.xib and make it a UIButton and when it is pressed it will comeout of the game. How to do that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vikas Shanbhogue</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-7930</link>
		<dc:creator>Vikas Shanbhogue</dc:creator>
		<pubDate>Fri, 26 Aug 2011 20:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-7930</guid>
		<description><![CDATA[No worries .. Yeah the formatting is weird because I copied it straight out of XCode ..Â 

I don&#039;t understand why I can&#039;t edit my comment..Â ]]></description>
		<content:encoded><![CDATA[<p>No worries .. Yeah the formatting is weird because I copied it straight out of XCode ..Â </p>
<p>I don&#8217;t understand why I can&#8217;t edit my comment..Â </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Griffin</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-7342</link>
		<dc:creator>Joe Griffin</dc:creator>
		<pubDate>Fri, 29 Jul 2011 16:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-7342</guid>
		<description><![CDATA[Thanks for the &lt;a href=&quot;http://www.gameshastra.com/Video-Game-Development.html&quot; rel=&quot;nofollow&quot;&gt;iphone game development&lt;/a&gt;. With the Apple phone&#039;s extreme popularity, this is definitely a good place for those interested in the field to start out.Â ]]></description>
		<content:encoded><![CDATA[<p>Thanks for the <a href="http://www.gameshastra.com/Video-Game-Development.html" rel="nofollow">iphone game development</a>. With the Apple phone&#8217;s extreme popularity, this is definitely a good place for those interested in the field to start out.Â </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Callum_holland</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-7240</link>
		<dc:creator>Callum_holland</dc:creator>
		<pubDate>Sun, 24 Jul 2011 22:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-7240</guid>
		<description><![CDATA[Bit confusing but i figured it out, u fixed a huge problem iv been working on with the ball getting &#039;stuck&#039; on the racquet, thanks manÂ ]]></description>
		<content:encoded><![CDATA[<p>Bit confusing but i figured it out, u fixed a huge problem iv been working on with the ball getting &#8216;stuck&#8217; on the racquet, thanks manÂ </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vikas Shanbhogue</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-6905</link>
		<dc:creator>Vikas Shanbhogue</dc:creator>
		<pubDate>Fri, 24 Jun 2011 20:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-6905</guid>
		<description><![CDATA[Sorry about the messy comment .. I don&#039;t know how to edit it.]]></description>
		<content:encoded><![CDATA[<p>Sorry about the messy comment .. I don&#8217;t know how to edit it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vikas Shanbhogue</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-6904</link>
		<dc:creator>Vikas Shanbhogue</dc:creator>
		<pubDate>Fri, 24 Jun 2011 20:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-6904</guid>
		<description><![CDATA[Hey .. This was a great tutorial .. Very well explained.
I&#039;m a programmer but have had a problem with how to structure games and this helped a lot.

Â I noticed a problem with your code, let me know if anyone else faced this issue.Â 







p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #401a7f}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #508187}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0271c}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}
span.s1 {color: #000000}
span.s2 {color: #bb23a0}
span.s3 {color: #508187}
span.s4 {color: #733aa7}
span.s5 {color: #3523d5}
span.s6 {color: #401a7f}
span.Apple-tab-span {white-space:pre}



if (CGRectIntersectsRect(ball.frame, racquet_yellow.frame))Â 
		{if (ball.center.y &lt; racquet_yellow.center.y)Â 
			ballVelocity.y = - ballVelocity.y;}}
			
	So you explained the purpose of having ball.center.y &lt; racquet_yellow.center.y. A problem I faced was that when the ball was going back in an upwards direction it would intersect with racquet_yellow.frame and meet the second if condition and keep moving back and forth.Â I faced the same problem with the green racquet.Â A simple fix is as follows:





p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #401a7f}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #508187}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0271c}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}
span.s1 {color: #000000}
span.s2 {color: #bb23a0}
span.s3 {color: #508187}
span.s4 {color: #733aa7}
span.s5 {color: #3523d5}
span.s6 {color: #401a7f}
span.Apple-tab-span {white-space:pre}




	if (CGRectIntersectsRect(ball.frame, racquet_yellow.frame)) {
		if (ball.center.y  0) {
			ballVelocity.y = - ballVelocity.y;	
		}
	}This ensures that the only time the ball gets deflected is when the ball is moving towards the yellow racquet and not when it is moving away from it.Similarly for the green racquet&#039;s if condition I would add &quot;&amp;&amp; ballVelocity.y &lt; 0 &quot;.Â I did not watch your video but an additional note: Â To ensure that frames intersect, I would increase the height of both racquets a little (only if they don&#039;t intersect on both sides).I hope this helped rather than confused people. Also let me know if there was an easier fix!Â ]]></description>
		<content:encoded><![CDATA[<p>Hey .. This was a great tutorial .. Very well explained.<br />
I&#8217;m a programmer but have had a problem with how to structure games and this helped a lot.</p>
<p>Â I noticed a problem with your code, let me know if anyone else faced this issue.Â </p>
<p>p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px}<br />
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #401a7f}<br />
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #508187}<br />
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0271c}<br />
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}<br />
span.s1 {color: #000000}<br />
span.s2 {color: #bb23a0}<br />
span.s3 {color: #508187}<br />
span.s4 {color: #733aa7}<br />
span.s5 {color: #3523d5}<br />
span.s6 {color: #401a7f}<br />
span.Apple-tab-span {white-space:pre}</p>
<p>if (CGRectIntersectsRect(ball.frame, racquet_yellow.frame))Â <br />
		{if (ball.center.y &lt; racquet_yellow.center.y)Â <br />
			ballVelocity.y = &#8211; ballVelocity.y;}}</p>
<p>	So you explained the purpose of having ball.center.y &lt; racquet_yellow.center.y. A problem I faced was that when the ball was going back in an upwards direction it would intersect with racquet_yellow.frame and meet the second if condition and keep moving back and forth.Â I faced the same problem with the green racquet.Â A simple fix is as follows:</p>
<p>p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px}<br />
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #401a7f}<br />
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #508187}<br />
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0271c}<br />
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}<br />
span.s1 {color: #000000}<br />
span.s2 {color: #bb23a0}<br />
span.s3 {color: #508187}<br />
span.s4 {color: #733aa7}<br />
span.s5 {color: #3523d5}<br />
span.s6 {color: #401a7f}<br />
span.Apple-tab-span {white-space:pre}</p>
<p>	if (CGRectIntersectsRect(ball.frame, racquet_yellow.frame)) {<br />
		if (ball.center.y  0) {<br />
			ballVelocity.y = &#8211; ballVelocity.y;<br />
		}<br />
	}This ensures that the only time the ball gets deflected is when the ball is moving towards the yellow racquet and not when it is moving away from it.Similarly for the green racquet&#8217;s if condition I would add &#8220;&amp;&amp; ballVelocity.y &lt; 0 &quot;.Â I did not watch your video but an additional note: Â To ensure that frames intersect, I would increase the height of both racquets a little (only if they don&#039;t intersect on both sides).I hope this helped rather than confused people. Also let me know if there was an easier fix!Â </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JB</title>
		<link>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comment-6746</link>
		<dc:creator>JB</dc:creator>
		<pubDate>Wed, 15 Jun 2011 04:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://icodeblog.com/?p=656#comment-6746</guid>
		<description><![CDATA[
I also have another problem, sometimes te ball hits the score bounds but it simply bounces and the game continues, no score detected.]]></description>
		<content:encoded><![CDATA[<p>I also have another problem, sometimes te ball hits the score bounds but it simply bounces and the game continues, no score detected.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
