<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Whitaker Blackall - Music and Sound FX for Video Games</title>
	
	<link>http://www.whitakerblackall.com</link>
	<description>Music for Games</description>
	<lastBuildDate>Wed, 25 Jan 2012 00:27:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/WhitakerBlackall" /><feedburner:info uri="whitakerblackall" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>And the name of the game is . . .</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/1t3cZV7tc-k/</link>
		<comments>http://www.whitakerblackall.com/blog/and-the-name-of-the-game-is/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 00:27:27 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Blog Post]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1731</guid>
		<description><![CDATA[

My game is called Polymer. Let me explain why.

According to Wikipedia, &#8220;A polymer is a large molecule composed of repeating structural units.&#8221; Here is a picture of real polymers:



In the game, the goal is to form strands of connected units. This isn&#8217;t a match-3 game though. The units can only be connected in particular ways...]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo.png" alt="" title="photo" width="320" height="480" class="aligncenter size-full wp-image-1732" /></p>
<p><br/></p>
<p>My game is called Polymer. Let me explain why.</p>
<p><br/></p>
<p>According to Wikipedia, &#8220;A polymer is a large molecule composed of repeating structural units.&#8221; Here is a picture of real polymers:</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/Single_Polymer_Chains_AFM.jpeg" alt="" title="Single_Polymer_Chains_AFM" width="320" height="320" class="aligncenter size-full wp-image-1740" /></p>
<p><br/></p>
<p>In the game, the goal is to form strands of connected units. This isn&#8217;t a match-3 game though. The units can only be connected in particular ways according to their rotations. Each unit&#8217;s rotation is chosen randomly, so you never know exactly what you&#8217;re going to be able to make. A molecular polymer&#8217;s sub-units &#8220;are typically connected by covalent chemical bonds.&#8221; In my game, each unit has a dark half-circle on all sides that need to be connected to something else to form a true bond. When a bond is found, the half-circle disappears.</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo-copy.png" alt="" title="photo copy" width="320" height="480" class="aligncenter size-full wp-image-1733" /></p>
<p><br/></p>
<p>To put it simply, finding matches in my game is a lot like the gameplay in the board game Carcassonne. In Carcassonne, there are many ways to match tiles together, but they only connect in certain locations. By the end of the game, you have a pretty cool looking city with procedurally generated castles, fields, roads, and rivers. I wanted to emulate this gameplay style because I&#8217;ve never really seen it done before in a matching game and I&#8217;m <strong>insanely</strong> bored of regular match-3 games.</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/carcassonne.jpeg" alt="" title="carcassonne" width="532" height="320" class="aligncenter size-full wp-image-1739" /></p>
<p><br/></p>
<p>As I said above, at the end of a game of Carcassonne, you have created a pretty cool looking city. Similarly, Polymer saves your best creation during a game so that you can revel in your molecule-forming abilities, or show off to friends. Plus, you&#8217;ll be able to Tweet your creations from within the app. Here are some Polymers I&#8217;ve made so far, from fairly simple to crazy complex (obviously, the bigger the Polymer, the more points it&#8217;s worth):</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo-3.jpg" alt="" title="photo 3" width="320" height="416" class="aligncenter size-full wp-image-1737" /></p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo-4.jpg" alt="" title="photo 4" width="320" height="416" class="aligncenter size-full wp-image-1737" /></p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo-2.jpg" alt="" title="photo 2" width="320" height="416" class="aligncenter size-full wp-image-1737" /></p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo-1.jpg" alt="" title="photo 1" width="320" height="416" class="aligncenter size-full wp-image-1737" /></p>
<p><br/></p>
<p>Thanks for reading (and special thanks to my wife Dana for coming up with the name)! Expect more soon.</p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/1t3cZV7tc-k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/and-the-name-of-the-game-is/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.whitakerblackall.com/blog/and-the-name-of-the-game-is/</feedburner:origLink></item>
		<item>
		<title>My first app!</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/r1WmGQTEEjI/</link>
		<comments>http://www.whitakerblackall.com/blog/my-first-app/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 14:06:57 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Blog Post]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1721</guid>
		<description><![CDATA[Big news here: I&#8217;m creating my first app for submission into the iPhone App Store! I&#8217;ve been working really hard for the last week and a half or so on it, and I&#8217;m going to keep going until it&#8217;s done (probably a month or two). Here are a couple screen shots.


The title screen. The UI...]]></description>
			<content:encoded><![CDATA[<p>Big news here: I&#8217;m creating my first app for submission into the iPhone App Store! I&#8217;ve been working really hard for the last week and a half or so on it, and I&#8217;m going to keep going until it&#8217;s done (probably a month or two). Here are a couple screen shots.</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo-1.png" alt="" title="photo 1" width="320" height="480" class="aligncenter size-full wp-image-1723" /><br />
The title screen. The UI button thingies slide to the right to open different scenes and start games. The game type names are all temporary. I&#8217;m going to try to think of better ones. The three rows of shapes slide left or right for visual effect.</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo-2.png" alt="" title="photo 2" width="320" height="480" class="aligncenter size-full wp-image-1723" /><br />
The endless/survival game mode. Create matches for as long as you want, but you better match the bomb pieces before their time runs out or you&#8217;ll lose.</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2012/01/photo-3.png" alt="" title="photo 3" width="320" height="480" class="aligncenter size-full wp-image-1723" /><br />
The onslaught game mode. Create matches for points, but don&#8217;t be too slow because the board keeps filling up. Sort of like a version of Tetris where the pieces appear in random places instead of always from the top.</p>
<p><br/></p>
<p>Keep in mind that &#8220;Myto&#8221; is just a temporary name because I thought it sounded kinda cool. It probably won&#8217;t be what it&#8217;s actually called. It&#8217;s basically a bastardized, shortened version of &#8220;Mitosis.&#8221; I&#8217;m still brain storming about names, so let me know if you have other ideas!</p>
<p><br/></p>
<p>The gameplay is like a mix of Bejewled and Trism. You slide rows and columns to try to make matches. But instead of matching colors, you match sides to each other. The goal is to complete a shape without any unmatched sides. The little black half-circles indicate sides that are currently unmatched. By doing this, you end up making crazy shapes and chains.</p>
<p><br/></p>
<p>I&#8217;ve been working really hard on making the visual, audio, and gameplay experience as smooth as possible. Even though I&#8217;ve never really done much actual design work, I&#8217;m trying to make it look really streamlined. I&#8217;m constantly opening up Photoshop and making small adjustments to things until they look pretty good.</p>
<p><br/></p>
<p>I didn&#8217;t really set out to make a finished app at first, but the more I worked on the game, the more I enjoyed playing it. I&#8217;ve been doing a TON of iterative design. It is completely different than it was when I first started. It&#8217;s been a really fun experience, and I have also learned a more about programming than I have in a long while. It&#8217;s amazing the problems you have to figure out when trying to push through to create a finished product. In the past, when my code got to spaghetti-ish and I couldn&#8217;t figure out what I was doing, I would just abandon the project and start again. Every time, my code got better. This time, I&#8217;ve really had to be careful so that I can maintain all the separate classes without them getting too confusing or anything, because it just keeps growing and growing.</p>
<p><br/></p>
<p>I still have a lot to do. Some things I still need to add are pop-up score labels for matches, a way to save/load gamestate, GameCenter integration, some sort of animation when you make a match rather then just fading out, actual options (right now there&#8217;s nothing really in the Options menu), some more audio/music, In-App Purchase for different types of shapes and game modes to play with, and more. I&#8217;m super excited about this and can&#8217;t wait to share more!</p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/r1WmGQTEEjI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/my-first-app/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://www.whitakerblackall.com/blog/my-first-app/</feedburner:origLink></item>
		<item>
		<title>My Submission for the Gunpoint Game Music</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/DhfTZ0AaneE/</link>
		<comments>http://www.whitakerblackall.com/blog/my-submission-for-the-gunpoint-game-music/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 19:05:23 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Blog Post]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1718</guid>
		<description><![CDATA[
So there&#8217;s an open audition-type thing for the game Gunpoint and I did a tune for it. More info about this audition/contest thingy here.
Please listen on headphones or good speakers. It sounds way better! Also, the sub bass drone can be a bit overpowering on speakers with a good low end, but I boosted it...]]></description>
			<content:encoded><![CDATA[<p><iframe width="560" height="315" src="http://www.youtube.com/embed/SNkwZsdpg1g" frameborder="0" allowfullscreen></iframe></p>
<p>So there&#8217;s an open audition-type thing for the game Gunpoint and I did a tune for it. More info about this audition/contest thingy <a href=" http://www.pentadact.com/2011-11-30-more-on-making-music-for-gunpoint/">here</a>.</p>
<p>Please listen on headphones or good speakers. It sounds way better! Also, the sub bass drone can be a bit overpowering on speakers with a good low end, but I boosted it a bit so that people listening on crappy speakers could at least hear it somewhat.</p>
<p>I really just went with my feeling on this. I kept adding a bunch of things that just felt like they should be there. It&#8217;s sort of a mix between electronica and spy movie soundtracks. Plus maybe a bit of Pink Floyd&#8217;s David Gilmour. This was amazingly fun to do!</p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/DhfTZ0AaneE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/my-submission-for-the-gunpoint-game-music/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.whitakerblackall.com/blog/my-submission-for-the-gunpoint-game-music/</feedburner:origLink></item>
		<item>
		<title>Cardinal Quest: Original Soundtrack is OUT!</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/ljF30eOij6g/</link>
		<comments>http://www.whitakerblackall.com/blog/cardinal-quest-original-soundtrack-is-out/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 06:34:08 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Blog Post]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1711</guid>
		<description><![CDATA[

Not only does it have all the original music from the game, but it also has unreleased tracks, as well as covers by Satstuma Audio,  Disasterpeace, Joe Cavers, Charlie McCarron, Cain German and some1namedjeff. Go get it at www.CardinalQuestMusic.com!

Cardinal Quest: Original Soundtrack by Whitaker Blackall
]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/12/Cardinal-Quest-Cover-copy1.png" alt="" title="Cardinal Quest Cover copy" width="500" height="500" class="aligncenter size-full wp-image-1713" /></p>
<p><br/></p>
<p>Not only does it have all the original music from the <a href="http://www.cardinalquest.com">game</a>, but it also has unreleased tracks, as well as covers by <a href="http://www.satsuma-audio.com">Satstuma Audio</a>,  <a href="http://www.disasterpeace.com">Disasterpeace</a>, <a href="http://flavors.me/joecavers">Joe Cavers</a>, <a href="http://www.charliemccarron.com">Charlie McCarron</a>, <a href="http://www.caingerman.com">Cain German</a> and <a href="http://www.jeffedwardball.com">some1namedjeff</a>. Go get it at <a href="http://www.cardinalquestmusic.com">www.CardinalQuestMusic.com</a>!</p>
<p><br/></p>
<p><iframe width="300" height="410" style="position: relative; display: block; width: 300px; height: 410px;" src="http://bandcamp.com/EmbeddedPlayer/v=2/album=2588159267/size=grande3/bgcol=f4f3ed/linkcol=4285BB/" allowtransparency="true" frameborder="0"><a href="http://wblackall.bandcamp.com/album/cardinal-quest-original-soundtrack">Cardinal Quest: Original Soundtrack by Whitaker Blackall</a></iframe></p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/ljF30eOij6g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/cardinal-quest-original-soundtrack-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.whitakerblackall.com/blog/cardinal-quest-original-soundtrack-is-out/</feedburner:origLink></item>
		<item>
		<title>Marriage and Name Change!</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/H99MvB1gORc/</link>
		<comments>http://www.whitakerblackall.com/blog/marriage-and-name-change/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 00:42:35 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Blog Post]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1698</guid>
		<description><![CDATA[Big news. First of all, I just got married last weekend to my beautiful girlfriend of 6 years, Dana! It was incredible. We then went to St. Lucia for our honeymoon, which was just sweet. Here&#8217;s a picture of us in St. Lucia:



Name Change
Dana&#8217;s last name is Tesser and mine is obviously Blackall. Some possibilities...]]></description>
			<content:encoded><![CDATA[<p>Big news. First of all, I just got married last weekend to my beautiful girlfriend of 6 years, Dana! It was incredible. We then went to St. Lucia for our honeymoon, which was just sweet. Here&#8217;s a picture of us in St. Lucia:</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/12/IMG_01461.jpg" alt="" title="IMG_0146" width="500" height="374" class="aligncenter size-full wp-image-1700" /></p>
<p><br/></p>
<h2>Name Change</h2>
<p>Dana&#8217;s last name is <strong>Tesser</strong> and mine is obviously <strong>Blackall</strong>. Some possibilities we considered:</p>
<ul class="bullet">
<li>Dana changes her last name to Blackall</li>
<li>I change my last name to Tesser</li>
<li>We change both of our last names to Tesser-Blackall or Blackall-Tesser</li>
<li>We make up an entirely new last named based on the letters of both</li>
</ul>
<p><br class="clear" /></p>
<p>We ended up going with the last one. That way, we&#8217;ll have a name we both love. We won&#8217;t have to worry about what name our kid takes (if/when we have one). And it won&#8217;t be all clunky like a hyphenated name. We wanted to do this because, well . . . why not? Why does the woman always have to be the one to change? And why not make a sweet new name?</p>
<p><br/></p>
<p>We took four letters from each last name. From TESSER, we took <strong>T</strong>, <strong>E</strong>, <strong>E</strong>, and <strong>R</strong>. And from BLACKALL, we took <strong>B</strong>, <strong>A</strong>, <strong>L</strong>, and <strong>L</strong>.</p>
<p><br/></p>
<p>We then rearranged them and combined them into <strong>TREBELLA.</strong></p>
<p><br/></p>
<p>Nothing is set in stone yet. We have to actually go through the process of changing it officially, then changing passports, driver&#8217;s licenses, etc. That&#8217;ll be extremely annoying. But it&#8217;ll be worth it. We will now be Whitaker and Dana Trebella!</p>
<p><br/></p>
<p>I have changed my Twitter name to @wtrebella. And I just registered www.TrebellaMusic.com. So keep an eye out, because I&#8217;ll eventually be moving over to that domain.</p>
<p><br/></p>
<p>Thanks for reading!</p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/H99MvB1gORc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/marriage-and-name-change/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.whitakerblackall.com/blog/marriage-and-name-change/</feedburner:origLink></item>
		<item>
		<title>Chunkopia</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/rT1l1rz9eOc/</link>
		<comments>http://www.whitakerblackall.com/blog/chunkopia/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 05:31:34 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1689</guid>
		<description><![CDATA[A remix of a song I did for Anosou&#8217;s brilliant Cobalt OST
]]></description>
			<content:encoded><![CDATA[<p>A remix of a song I did for Anosou&#8217;s brilliant Cobalt OST</p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/rT1l1rz9eOc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/chunkopia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.whitakerblackall.com/blog/chunkopia/</feedburner:origLink></item>
		<item>
		<title>Cobalt EP Out!</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/Y0KmMj8Qi3I/</link>
		<comments>http://www.whitakerblackall.com/blog/cobalt-ep-out/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 05:27:39 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Blog Post]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1683</guid>
		<description><![CDATA[

The soundtrack to the upcoming indie game Cobalt is out and I have a remix on it! The music is by Anosou, who&#8217;s incredible. The album also features remixes by Chris Geehan, Jimmy Hinson (bigGIANTcircles), Magnus Pålsson (SoulEye), Daniel Rosenfeld (C418), and Steven Velema (surasshu). I&#8217;m proud and humbled to be in such good company.

My...]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/11/629311331-1.jpeg" alt="" title="629311331-1" width="350" height="350" class="aligncenter size-full wp-image-1685" /></p>
<p><br/></p>
<p>The soundtrack to the upcoming indie game <a href="http://www.oxeyegames.com/cobalt/">Cobalt</a> is out and I have a remix on it! The music is by Anosou, who&#8217;s incredible. The album also features remixes by Chris Geehan, Jimmy Hinson (bigGIANTcircles), Magnus Pålsson (SoulEye), Daniel Rosenfeld (C418), and Steven Velema (surasshu). I&#8217;m proud and humbled to be in such good company.</p>
<p><br/></p>
<p>My remix is called Chunkopia. Listen to it below (as well as all the other amazing music on the album). It&#8217;s my first actual remix. Usually I do covers but I actually used some of the original audio in this one, which I think makes it a remix. It&#8217;s a weird mix of genres. Hope you like it!</p>
<p><br/></p>
<p><iframe width="300" height="410" style="position: relative; display: block; width: 300px; height: 410px;" src="http://bandcamp.com/EmbeddedPlayer/v=2/album=271990126/size=grande3/bgcol=f4f4ed/linkcol=4285BB/" allowtransparency="true" frameborder="0"><a href="http://anosou.bandcamp.com/album/cobalt-ep">Cobalt EP by anosou</a></iframe></p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/Y0KmMj8Qi3I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/cobalt-ep-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/11/Cobalt-Cover-1.5.mp3" length="5189402" type="audio/mpeg" />
		<feedburner:origLink>http://www.whitakerblackall.com/blog/cobalt-ep-out/</feedburner:origLink></item>
		<item>
		<title>Snake and Racer: A Flixel Detour</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/VVtikim6KpE/</link>
		<comments>http://www.whitakerblackall.com/blog/snake-and-racer-a-flixel-detour/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 21:28:53 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1654</guid>
		<description><![CDATA[I took a little break from Objective C for awhile and learned the basics of Actionscript 3. It&#8217;s a really simple language, and with the help of the awesome Flixel, I was able to make a couple games pretty quickly.
The first game I made was Snake.

Snake




Making this game really helped me understand the basics of...]]></description>
			<content:encoded><![CDATA[<p>I took a little break from Objective C for awhile and learned the basics of Actionscript 3. It&#8217;s a really simple language, and with the help of the awesome <a href="http://flixel.org">Flixel</a>, I was able to make a couple games pretty quickly.</p>
<p>The first game I made was Snake.</p>
<p><br/></p>
<h2>Snake</h2>
<p><a href="http://www.whitakerblackall.com/wp-content/uploads/2011/08/Screen-shot-2011-08-08-at-4.17.42-PM.png"><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/08/Screen-shot-2011-08-08-at-4.17.42-PM-300x277.png" alt="" title="Screen shot 2011-08-08 at 4.17.42 PM" width="300" height="277" class="aligncenter size-medium wp-image-1665" /></a></p>
<p><br/></p>
<p><a href="http://www.whitakerblackall.com/wp-content/uploads/2011/08/Screen-shot-2011-08-08-at-4.18.00-PM.png"><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/08/Screen-shot-2011-08-08-at-4.18.00-PM-300x279.png" alt="" title="Screen shot 2011-08-08 at 4.18.00 PM" width="300" height="279" class="aligncenter size-medium wp-image-1666" /></a></p>
<p><br/></p>
<p>Making this game really helped me understand the basics of Actionscript 3 and Flixel. It was surprisingly easy to make! My code got pretty sloppy after awhile though, so I wanted to try making another game, this time keeping clean, documented code.</p>
<p><br/></p>
<p><a href="http://whitakerblackall.com/wp-content/uploads/Snake.swf">Play Snake here.</a></p>
<p><br/></p>
<p>The next game I made was another really common one. All you need to do is avoid the walls. There are three levels of difficulty (either click or press the number on your keyboard to start the game). Sorry, but if you start playing in one difficulty, you have to refresh the page to change the level, because out of laziness, I never built in a &#8220;Go Back to Menu&#8221; button. Also, sorry, but I made one piece of music that I used for both games, so hopefully you won&#8217;t get sick of it.</p>
<p><br/></p>
<h2>Racer</h2>
<p><a href="http://www.whitakerblackall.com/wp-content/uploads/2011/08/Screen-shot-2011-08-08-at-4.20.19-PM.png"><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/08/Screen-shot-2011-08-08-at-4.20.19-PM-300x211.png" alt="" title="Screen shot 2011-08-08 at 4.20.19 PM" width="300" height="211" class="aligncenter size-medium wp-image-1667" /></a></p>
<p><br/></p>
<p><a href="http://www.whitakerblackall.com/wp-content/uploads/2011/08/Screen-shot-2011-08-08-at-4.20.49-PM.png"><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/08/Screen-shot-2011-08-08-at-4.20.49-PM-300x214.png" alt="" title="Screen shot 2011-08-08 at 4.20.49 PM" width="300" height="214" class="aligncenter size-medium wp-image-1668" /></a></p>
<p><br/></p>
<p><a href="http://whitakerblackall.com/wp-content/uploads/Racer.swf">Play Racer here.</a></p>
<p><br/></p>
<p>One of the main reasons I wanted to keep the code clean is because I wanted to open source the game. I tried to document every major thing in the code so it would be easily understandable. I&#8217;m sure there are still many things I could have done better, as I am definitely still learning, but anyone is free to download it and muck around with it. <a href="http://whitakerblackall.com/wp-content/uploads/Racer.rar">Download the full source folder here.</a></p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/VVtikim6KpE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/snake-and-racer-a-flixel-detour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.whitakerblackall.com/blog/snake-and-racer-a-flixel-detour/</feedburner:origLink></item>
		<item>
		<title>The Making of the Velocispider Theme</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/wVqJPv7T4AI/</link>
		<comments>http://www.whitakerblackall.com/blog/the-making-of-the-velocispider-theme/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 08:50:44 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Blog Post]]></category>
		<category><![CDATA[iDevBlogADay]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1628</guid>
		<description><![CDATA[
Whenever I listen to other people&#8217;s music, I always wonder how the hell they made it. Of course, I can try to break a track down by ear, but I&#8217;d love to get an inside look. So that&#8217;s what I&#8217;m giving you! I have isolated an eight measure section of the Velocispider theme that I...]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Velocispider-Pianist1.png" alt="" title="Velocispider Pianist" width="500" height="330" class="aligncenter size-full wp-image-1646" /></p>
<p>Whenever I listen to other people&#8217;s music, I always wonder how the hell they made it. Of course, I can try to break a track down by ear, but I&#8217;d love to get an inside look. So that&#8217;s what I&#8217;m giving you! I have isolated an eight measure section of the <a href="http://www.whitakerblackall.com/blog/velocispider-theme/">Velocispider theme</a> that I am going to take you through track by track. Before we start, listen to the eight bar section as a whole:</p>
<p><br/></p>
<p><br/></p>
<h2>The Bass Synths</h2>
<p>I have two bass synths in this song. They were both made from scratch using Logic&#8217;s ES2 synth (as you&#8217;ll soon see, I use it all the time). I have a setting for the ES2 I made called &#8220;Basic&#8221; that cuts everything away and lets me start with a basic saw wave. From there, I start adding modulations, adjusting the ADSR envelope, setting the cutoff frequency and a bunch of other stuff. Here&#8217;s the first bass synth I came up with:</p>
<p><br/></p>
<p><br/></p>
<p>I liked it but thought it could use some extra, grittier high end. While I could probably add some of this to the first synth, sometimes I like to make two separate ones so I can adjust them individually and give it a fuller sound. Here&#8217;s the second bass, playing the exact same part:</p>
<p><br/></p>
<p><br/></p>
<p>When I put the bass parts together, I really liked the way they sounded:</p>
<p><br/></p>
<p><br/></p>
<h2>The Chords</h2>
<p>On top of the bass part, I wanted to add some harmonic and rhythmic direction. To do this, I added a very simple chord part using another ES2 synth I created. The part is playing the exact same chord the whole time so it gives the song harmonic support while bringing some more energy to the plate:</p>
<p><br/></p>
<p><br/></p>
<h2>Side Chained Synth Pad</h2>
<p>One of the things that gives this song its character is the pulsating, washy synth pad in the background. The synth pad is actually a preset ES2 setting that comes with Logic called Design Pad (with a few slight tweaks). Here&#8217;s the sound of the synth pad playing the chord throughout the section:</p>
<p><br/></p>
<p><br/></p>
<p>Pretty cool sounding synth, but where&#8217;s the rhythmic pulsing? I created that using a technique called <strong>side chaining</strong>. Wikipedia explains it better than I could: <em>&#8220;When side-chaining, the compressor uses the volume level of an input signal to determine how strongly the compressor will reduce the gain on its output signal.&#8221;</em> Basically, when the input signal occurs, the compressor turns on. In this case, I wanted the synth pad to be compressed (decrease in volume) every beat, so I first needed to create the input signal. While the input signal really could have been anything, I like to use a kick drum because it is clear, short, and not noisy. Besides, the kick drum is very often used as a side chain signal in a lot of music. Here is the synth pad, this time with compression side chained to the kick drum:</p>
<p><br/></p>
<p><br/></p>
<p>As you can see, the volume of the synth pad gets quieter every time the kick drum plays, giving it a pulsating, sucking sound. I didn&#8217;t want to turn the Velocispider theme into a dance track though, so I muted the kick drum, leaving just the pulsating synth:</p>
<p><br/></p>
<p><br/></p>
<h2>The Drums</h2>
<p>All we have left are the drums. I used three different preset Ultrabeat drum kits that come with Logic. The first kit I used is called &#8220;Hip Hop Heavy Kit.&#8221; I used this kit to establish the main drum beat and ground it rhythmically:</p>
<p><br/></p>
<p><br/></p>
<p>On top of that, I added the &#8220;Downtempo Kit 02&#8243;, primarily for its electronic snares:</p>
<p><br/></p>
<p><br/></p>
<p>The last drum kit I added was &#8220;IDM Elements 02.&#8221; Out of the three drum kits, I think this is the one that gives the theme the most character. It sounds pretty random alone, but when coupled with the rest of the drums, really stands out. Here it is alone:</p>
<p><br/></p>
<p><br/></p>
<p>And here is the full drum section, all three kits on top of each other:</p>
<p><br/></p>
<p><br/></p>
<h2>The Slide</h2>
<p>The last thing in this section is the pulsating, sliding synth that starts it off, then rises in pitch throughout it. I created this synth using the ES2 as well, using two oscillators (sound waves) that were a perfect fifth apart. I also gave the synth the ability to bend 36 steps up or down, which equates to a huge six octave range. This allowed me to bend the hell out of the synth, reaching a ton of pitches, all while using just one MIDI note. The synth starts with a quick downward bend to bring in the section, then rises for the rest of the time. The pulsating is just a simple frequency cutoff modulation that is synced to a 1/16th note rhythm. Here&#8217;s the sliding synth:</p>
<p><br/></p>
<p><br/></p>
<h2>Conclusion</h2>
<p>Those tracks are literally <strong>all</strong> there is in that section of the song. I&#8217;m not hiding anything from you. Here&#8217;s the full thing one more time, so you lazy people don&#8217;t have to scroll back up to the top:</p>
<p><br/></p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/wVqJPv7T4AI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/the-making-of-the-velocispider-theme/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Full-Sample.mp3" length="331985" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Bass-1.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Bass-2.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Bass-Both.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Chords.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Design-Pad.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Design-Pad-Kick.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Design-Pad-Chained.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Hip-Hop-Heavy-Kit.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/IDM-Elements-02.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Slide.mp3" length="255499" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Downtempo-Kit-02.mp3" length="312550" type="audio/mpeg" />
<enclosure url="http://www.whitakerblackall.com/wp-content/uploads/2011/06/Full-Drums.mp3" length="312550" type="audio/mpeg" />
		<feedburner:origLink>http://www.whitakerblackall.com/blog/the-making-of-the-velocispider-theme/</feedburner:origLink></item>
		<item>
		<title>Making the Music App: Part II</title>
		<link>http://feedproxy.google.com/~r/WhitakerBlackall/~3/suB3KHF0Jwo/</link>
		<comments>http://www.whitakerblackall.com/blog/making-the-music-app-part-ii/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 10:00:21 +0000</pubDate>
		<dc:creator>Whitaker</dc:creator>
				<category><![CDATA[Blog Post]]></category>
		<category><![CDATA[iDevBlogADay]]></category>

		<guid isPermaLink="false">http://www.whitakerblackall.com/?p=1582</guid>
		<description><![CDATA[In the first post about this music app, I talked about the musical aspects. In the second post, I created the MusicPad class. In this post, I am going to finish the app with MusicInterface and MusicLayer classes. Before we move on though, let me show you the defines I put in the GameConfig.h file.

GameConfig.h...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whitakerblackall.com/blog/musicapp/">In the first post</a> about this music app, I talked about the musical aspects. <a href="http://www.whitakerblackall.com/blog/making-the-music-app-i/">In the second post</a>, I created the MusicPad class. In this post, I am going to finish the app with MusicInterface and MusicLayer classes. Before we move on though, let me show you the defines I put in the GameConfig.h file.</p>
<p><br/></p>
<h3>GameConfig.h Defines</h3>
<pre>
<code>#define ROWS_NUM 8           // Number of rows of music pads in the interface
#define COLUMNS_NUM 6     // Number of columns of music pads in the interface
#define PADDING 10             // Amount of extra pixels on each side of every music pad
#define BEAT_TIME 0.125      // The length (in seconds) of each beat</code>
</pre>
<p><br/></p>
<h3>MusicInterface&#8217;s Interface</h3>
<pre>
<code>#import &lt;Foundation/Foundation.h&gt;
#import "cocos2d.h"

@class MusicPad;

@interface MusicInterface : CCLayer {
    NSMutableArray *musicPadArray;
    MusicPad *currentPad;
    bool isPlaying;
    int musicPadSideLength;
    int boardWidth;
    int boardHeight;
    int beatNum;
    float timeSinceLastBeat;
}

@property int musicPadSideLength, boardWidth, boardHeight;

+ (id) musicInterface;
- (MusicPad *) getPadForTouch:(UITouch *)touch;
- (BOOL) checkIndexBounds:(CGPoint)index;
- (void) play;

@end</code>
</pre>
<p><br/></p>
<h3>MusicInterface&#8217;s Instance Variables and Properties</h3>
<p><em>musicPadArray</em> is going to be a multidimensional array where we will keep all of the individual pads. <em>currentPad</em> is the music pad that the user has most recently touched (or is currently touching). <em>isPlaying</em> is so we know if the music loop is actually playing or not. <em>musicPadSideLength</em> is the length of each music pad&#8217;s side. I made this an instance variable instead of a define so that I could change the size of the image without breaking the code. <em>boardWidth</em> and <em>boardHeight</em> are the dimensions of the entire interface of music pads. <em>beatNum</em> is the current beat the song is on. Finally, <em>timeSinceLastBeat</em> is, quite obviously, the amount of time since the last beat occurred. I make musicPadSideLength, boardWidth, and boardHeight properties so we can use them later to position the interface within the full window.</p>
<p><br/></p>
<h3>MusicInterface&#8217;s Implementation (Code/Method File)</h3>
<pre>
<code>#import "MusicInterface.h"
#import "GameConfig.h"
#import "MusicPad.h"

@implementation MusicInterface

@synthesize musicPadSideLength, boardWidth, boardHeight;</code>
</pre>
<p><br/></p>
<p>Take care of the basics first.</p>
<p><br/></p>
<h3>MusicInterface Method: + (id) musicInterface</h3>
<pre>
<code>+ (id) musicInterface {
    return [[[MusicInterface alloc] init] autorelease];
}</code>
</pre>
<p><br/></p>
<p>This is another convenience method that returns an autoreleased musicInterface when you call [MusicInterface musicInterface].</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (id) init</h3>
<p>I&#8217;m going to split this method into chunks, because it&#8217;s pretty long (that&#8217;s what . . . she said . . .?).</p>
<p><br/></p>
<pre>
<code>- (id) init {
    if ((self = [super init])) {
        musicPadArray = [[NSMutableArray arrayWithCapacity:ROWS_NUM] retain];
        musicPadSideLength = 0;
        timeSinceLastBeat = BEAT_TIME;
        beatNum = 0;
        isPlaying = FALSE;
        currentPad = nil;</code>
</pre>
<p><br/></p>
<p>I initialize musicPadArray with the capacity of ROWS_NUM because I want it to be an array that contains a certain number of rows, which in turn contain a certain number of music pads (COLUMNS_NUM). The only other important piece of this part is when I set timeSinceLastBeat equal to BEAT_TIME. I do this because I don&#8217;t want there to be a delay between pressing the play button and starting the music. This way, it will start immediately (more on this later).</p>
<p><br/></p>
<pre>
<code>        // init method continued
        for (int i = 0; i &lt; ROWS_NUM; i++) {
            NSMutableArray *musicPadRow = [NSMutableArray arrayWithCapacity:COLUMNS_NUM];
            for (int j = 0; j &lt; COLUMNS_NUM; j++) {
                MusicPad *newMusicPad = [MusicPad musicPadWithIndexX:j andIndexY:i]
                if (musicPadSideLength == 0) {
                    musicPadSideLength = newMusicPad.contentSize.width;
                }
                newMusicPad.position = ccp(PADDING + (musicPadSideLength + PADDING) * j + musicPadSideLength / 2, PADDING + (musicPadSideLength + PADDING) * i + musicPadSideLength / 2);
                [newMusicPad setAudioFile:j];
                [musicPadRow insertObject:newMusicPad atIndex:j];
                [self addChild:newMusicPad];
            }
            [musicPadArray insertObject:musicPadRow atIndex:i];
        }</code>
</pre>
<p><br/></p>
<p>This section is where I create the actual rows that contain the individual music pads. I take the following steps for as many rows as ROWS_NUM specifies. I create musicPadRow, which is the NSMutableArray that will contain the music pads. Then, for as many columns as COLUMNS_NUM specifies, I create a new music pad. For each music pad, I first set its indices equal to where it is located within the multidimensional array, for easy access later. Then I set the musicPadSideLength equal to the width of the music pad image (I just use the width because they are exact squares). I have included &#8220;if (musicPadSideLength == 0)&#8221; because I only need to set the side length the first time (because I&#8217;m using the same image for every music pad).</p>
<p><br/></p>
<p>Setting the position of each music pad is the trickiest part of this method. I want them to be spaced evenly throughout the layer with an easily adjustable distance between each (PADDING). To clarify, &#8220;PADDING&#8221; is the space <em>between each music pad</em>. I&#8217;ll break this down: &#8220;ccp&#8221; is just a Cocos2d convenience macro for CGPointMake. I set the x position equal to &#8220;PADDING + (musicPadSideLength + PADDING) * j + musicPadSideLength / 2&#8243;. There is padding at the beginning so there is a blank space between the first pad and the edge of the screen. &#8220;(musicPadSideLength + PADDING) * j&#8221; is going to change for each pad, because &#8220;j&#8221; is equal to whichever pad number we&#8217;re on in the row. &#8220;musicPadSideLength / 2&#8243; is added at the end because CCSprites have an anchor point by default in their center. We need to shift them to the right by half their width so they are positioned correctly. The y position is set to &#8220;PADDING + (musicPadSideLength + PADDING) * i + musicPadSideLength / 2)&#8221;, which is almost exactly the same as the x position (except &#8220;i&#8221; is used instead of &#8220;j&#8221; for row number).</p>
<p><br/></p>
<p>Still with me? Good. Once the position is set, we set the audio file for the pad depending on which column it&#8217;s in (&#8220;j&#8221;). We then add the finished music pad to musicPadRow for later access. Then, we add the music pad to the layer as a child (so we can see it and interact with it). Finally, after each row is done, we add its musicPadRow to the overall musicPadArray at its row index (&#8220;i&#8221;).</p>
<p><br/></p>
<pre>
<code>    // init method continued
        boardWidth = (musicPadSideLength + PADDING) * COLUMNS_NUM + PADDING;
        boardHeight = (musicPadSideLength + PADDING) * ROWS_NUM + PADDING;

        self.isTouchEnabled = YES;
        [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
    }
    return self;
}</code>
</pre>
<p><br/></p>
<p>The last thing we do in the init method (we&#8217;re <em>still</em> on the init method? Wow) is store the board&#8217;s width and height, enable the layer for touches, and add the layer to the touch dispatcher as a targeted delegate (if you don&#8217;t know what this is, research. I&#8217;m definitely not the best person to explain it to you.)</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (BOOL) checkIndexBounds:(CGPoint)index</h3>
<pre>
<code>- (BOOL) checkIndexBounds:(CGPoint)index {
    if (index.x &lt; 0 || index.x &gt;= COLUMNS_NUM || index.y &lt; 0 || index.y &gt;= ROWS_NUM) {
        return NO;
    }
    else {
        return YES;
    }
}</code>
</pre>
<p><br/></p>
<p>This method does a quick check to see if a music pad exists at a certain index point. If either the x or y are too low or high, the function returns NO. If the x and y are in the bounds of our interface, the function returns YES (which means a pad exists at that index point).</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (MusicPad *) getPadForTouch:(UITouch *)touch</h3>
<pre>
<code>- (MusicPad *) getPadForTouch:(UITouch *)touch {
    CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
    int touchIndexX = ((int)touchLocation.x - (int)touchLocation.x % (musicPadSideLength + PADDING)) / (musicPadSideLength + PADDING);
    int touchIndexY = ((int)touchLocation.y - (int)touchLocation.y % (musicPadSideLength + PADDING)) / (musicPadSideLength + PADDING);

    if ([self checkIndexBounds:ccp(touchIndexX, touchIndexY)]) {
        MusicPad *currentMusicPad = [[musicPadArray objectAtIndex:touchIndexY] objectAtIndex:touchIndexX];
        if (CGRectContainsPoint(currentMusicPad.boundingBox, touchLocation)) {
            return currentMusicPad;
        }
        else {
            return nil;
        }
    }
    else {
        return nil;
    }
}</code>
</pre>
<p><br/></p>
<p>This is a very important method. When the user taps a spot on the screen, this is the method that tells us which pad (if any) they touched. The first thing we do is convert the touch to the layer&#8217;s node space. This way, we can move the layer around in the overall window as much as we want and the touch will still be relative to <em>this layer</em>. We then need to convert the x and y points from pixels to indices. &#8220;(int)touchLocation.x &#8211; (int)touchLocation.x % (musicPadSideLength + PADDING)&#8221; subtracts any excess space the user touched inside the pad (for example, if they touched the pad at 47 pixels, this part will subtract the 7, leaving 40, which is exactly where the pad starts.) We then divide this by &#8220;(musicPadSideLength + PADDING)&#8221; to figure out which pad in the row the user touched. We then do the same thing with the y point.</p>
<p><br/></p>
<p>Next, we check the bounds. If the index point ends up being (-2, 13), for example, because the user touched somewhere outside of the interface, the function returns nil. If the index points to an actual pad (e.g. (1, 4)), the function then tests if the touch was actually inside the pad itself and not the padding between pads (wow, the wording in this thing is just getting more and more confusing isn&#8217;t it).</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event</h3>
<pre>
<code>- (BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
    MusicPad *currentMusicPad = [self getPadForTouch:touch];
    currentPad = currentMusicPad;
    [currentPad changeState];
    return YES;
}</code>
</pre>
<p><br/></p>
<p>This is the method that the layer needs to properly become a targeted touch delegate. All it does is find the pad the user touched, set it to the current pad, and change its state (on or off).</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event</h3>
<pre>
<code>- (void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event {
    MusicPad *currentMusicPad = [self getPadForTouch:touch];
    if (currentPad != currentMusicPad) {
        currentPad = currentMusicPad;
        [currentPad changeState];
    }
}</code>
</pre>
<p><br/></p>
<p>This method is almost exactly the same as ccTouchBegan, with one major difference: &#8220;if (currentPad != currentMusicPad)&#8221;. Without this, the pad will switch states <em>every time the user&#8217;s fingers is sensed to be on the pad and moving</em>. If you drag your finger across a pad, it will turn on and off very rapidly over and over. This addition just tells it not to switch the state of the pad unless it is a new one.</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event</h3>
<pre>
<code>- (void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event {
    currentPad = nil;
}</code>
</pre>
<p><br/></p>
<p>When the user lifts the touch, there is no longer a &#8220;currentPad&#8221; so we set it to nil.</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (void) update:(ccTime)delta</h3>
<pre>
<code>- (void) update:(ccTime)delta {
    timeSinceLastBeat += delta;

    if (timeSinceLastBeat &gt;= BEAT_TIME) {
        timeSinceLastBeat = 0;
        for (int i = 0; i &lt; COLUMNS_NUM; i++) {
            MusicPad *currentMusicPad = [[musicPadArray objectAtIndex:beatNum] objectAtIndex:i];
            [currentMusicPad play];
        }
        beatNum--;
        if (beatNum &lt; 0) {
            beatNum = 7;
        }
    }
}</code>
</pre>
<p><br/></p>
<p>The base class of every Cocos2d object (CCNode) has this update method. When [self scheduleUpdate] is called, this update method is then called as often as possible (multiple times per second). Every time the update is called, we add the delta time (the time difference between update calls) to the timeSinceLastBeat. If timeSinceLastBeat has elapsed the length of time a beat takes (in this case, one second), it finds the next row of music pads and plays each of their sounds. After playing, it subtracts one from the beat number. If beatNum goes below zero, it means it has reached the end of the interface and needs to start over. It seems a little bit strange that the beat starts at 7 and goes down to 0 instead of the other way around. I did this because of the way I placed the pads in the interface: 7 is the top row of pads, and 0 is the bottom.</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (void) play</h3>
<pre>
<code>- (void) play {
    if (isPlaying) {
        isPlaying = NO;
        timeSinceLastBeat = 1.0;
        [self unscheduleUpdate];
    else {
        isPlaying = YES;
        beatNum = 7;
        [self scheduleUpdate];
    }
}</code>
</pre>
<p><br/></p>
<p>This is the method that the play button is going to call to start and stop the song. If the song is playing, this method stops it, resets the time and unschedules the update. If it is not playing, it starts it, resets the beat number and schedules the update (make sure never to schedule and update that is already scheduled &#8211; it will throw an exception).</p>
<p><br/></p>
<h3>MusicInterface Method: &#8211; (void) dealloc</h3>
<pre>
<code>- (void) dealloc {
    [musicPadArray release];

    [super dealloc];
}

@end</code>
</pre>
<p><br/></p>
<p>The only thing we need to release in this object is the musicPadArray. Everything else will be released automatically.</p>
<p><br/></p>
<p>We are now done with the music interface! All we have to do now is center the interface in the overall window and give the user a button they can tap to start and stop the music. Next up is the MusicLayer class.</p>
<p><br/></p>
<h3>MusicLayer&#8217;s Interface</h3>
<pre>
<code>#import &lt;Foundation/Foundation.h&gt;
#import "cocos2d.h"

@class MusicInterface;

@interface MusicLayer : CCLayer {
    MusicInterface *musicInterface;
}

+ (id) scene;

@end</code>
</pre>
<p><br/></p>
<p>The MusicLayer class is what the AppDelegate is actually going to run. We are going to use it to place the interface in the overall window and give the user the button to press. The only method we need is the convenience method called scene. The only instance variable we need is the musicInterface.</p>
<p><br/></p>
<h3>MusicLayer&#8217;s Implementation (Code/Method File)</h3>
<pre>
<code>#import "MusicLayer.h"
#import "MusicInterface.h"
#import "SimpleAudioEngine.h"

@implementation MusicLayer</code>
</pre>
<p><br/></p>
<p>Some basic importing.</p>
<p><br/></p>
<h3>MusicLayer Method: + (id) scene</h3>
<pre>
<code>+ (id) scene {
    CCScene *scene = [CCScene node];
    MusicLayer *musicLayer = [MusicLayer node];
    [scene addChild:musicLayer];
    return scene;
}</code>
</pre>
<p><br/></p>
<p>This is the normal format of a Cocos2d scene method. This is the method that the AppDelegate uses to run the app.</p>
<p><br/></p>
<h3>MusicLayer Method: &#8211; (id) init</h3>
<pre>
<code>- (id) init {
    if ((self = [super init])) {
        CCLayerColor *background = [CCLayerColor layerWithColor:ccc4(30, 30, 30, 255)];
        [self addChild:background];

        for (int i = 0; i &lt; 6; i++) {
            NSString *audioFileName = [NSString stringWithFormat:@"%i.mp3"];
            [[SimpleAudioEngine sharedEngine] preloadEffect:audioFileName];
        }
        CGSize winSize = [[CCDirector sharedDirector] winSize];
        musicInterface = [MusicInterface musicInterface];
        musicInterface.position = ccp((winSize.width - musicInterface.boardWidth) / 2, (winSize.height - musicInterface.boardHeight) / 2 + 25);
        [self addChild:musicInterface];

        CCMenuItemImage *buttonItem = [CCMenuItemImage itemFromNormalImage:@"button.png" selectedImage:nil target:musicInterface selector:@selector(play)];
        CCMenu *buttonMenu = [CCMenu menuWithItems:buttonItem, nil];
        buttonMenu.position = ccp(winSize.width / 2, 35);
        [self addChild:buttonMenu];
    }
    return self;
}

@end</code>
</pre>
<p><br/></p>
<p>The first thing I do in the init method is to add a layer of color in the background so it&#8217;s not just pure black. Next, I preload all of the sound effects so there is no delay when the song first plays. The next important line is where we set the musicInterface&#8217;s position. The interface layer is a subclass of CCLayer, whose anchor point is located in the bottom left. Since I want to center the layer in the middle of the window, this takes a bit of maneuvering. &#8220;(winSize.width &#8211; musicInterface.boardWidth) / 2&#8243; sets its x position to the middle. &#8220;(winSize.height &#8211; musicInterface.boardHeight) / 2&#8243; sets its y position to the middle. I wanted the interface to be a bit higher so I hard coded an extra &#8220;25&#8243; into the y position. The last thing we do is create the play button. It&#8217;s pretty simple: I create the menu item with the musicInterface&#8217;s &#8220;play&#8221; method as its selector, then create a menu using this button, which I then place at the bottom center of the window.</p>
<p><br/></p>
<p>The very last thing you have to do to run the app is to tell the AppDelegate to run the MusicLayer class. At the beginning of the AppDelegate class, add &#8220;#import &#8220;MusicLayer.h&#8221;. Then find the line: &#8220;[[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];&#8221; and replace &#8220;HelloWorldLayer&#8221; with &#8220;MusicLayer&#8221;.</p>
<p><br/></p>
<p><em><strong>THAT&#8217;S. IT.</strong></em> <a href="http://www.whitakerblackall.com/wp-content/uploads/MusicAppSourceCode.zip">Here is the full source code, along with all the sound effects and images.</a></p>
<p>As a reward for you getting through the whole thing, here is a picture of me looking through an angry basket:</p>
<p><br/></p>
<p><img src="http://www.whitakerblackall.com/wp-content/uploads/2011/06/scaled.jpg" alt="" title="scaled" width="478" height="640" class="aligncenter size-full wp-image-1619" /></p>
<img src="http://feeds.feedburner.com/~r/WhitakerBlackall/~4/suB3KHF0Jwo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.whitakerblackall.com/blog/making-the-music-app-part-ii/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.whitakerblackall.com/blog/making-the-music-app-part-ii/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)

Served from: www.whitakerblackall.com @ 2012-01-25 20:16:35 -->

