<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CEUMQX8zeip7ImA9WhBbFEg.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912</id><updated>2013-05-13T14:38:00.182+01:00</updated><category term="ABE" /><category term="Terrain" /><category term="Minecraft" /><category term="3D" /><category term="Effects" /><category term="PMC Tutorials" /><category term="Asteroids" /><category term="Game" /><category term="Additive Blend Editor" /><category term="Retro" /><category term="HTML5" /><category term="PlayMyCode" /><title>FiveSprites</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.fivesprites.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.fivesprites.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Andy White</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>29</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Fivesprites" /><feedburner:info uri="fivesprites" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;AkcHQHs7fCp7ImA9WhBQGEQ.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-5140491730360024549</id><published>2013-03-21T20:33:00.000Z</published><updated>2013-03-21T20:33:51.504Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-21T20:33:51.504Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>What? Why? Eh? Shush!</title><content type="html">I'm not entirely sure what's going on at PlayMyCode, but the site has gone &lt;i&gt;very&lt;/i&gt; quiet lately.  There's been a few good games appear, but most of them just end up getting hidden in a torrent of awfulness.  
&lt;br&gt;&lt;br&gt;
I have a few games and projects that are almost ready for release there, but technical problems hold me back.  For example, the performance of Array is AWFUL!  It's so slow that creating and using tilemaps is painful.  When you need to access various parts of the tilemap arrays for rendering and collisions, you really do start to chug along. 
&lt;br&gt;&lt;br&gt;
The blog on PlayMyCode has gone almost a year without an update.  The recommended games section is never updated.  The forums are full of useless posts or people moaning about the lack of updates to PMC.  
&lt;br&gt;&lt;br&gt;
I'm sure things will improve, but for now, my favourite test bed for ideas has changed.  I'm now playing around with &lt;a href="http://theengine.co"&gt;Loom&lt;/a&gt; which is just lovely - and you can easily deploy to iOS/Android/HTML5 etc.  It's quite new so has a few quirks, but certainly looks promising.
&lt;br&gt;&lt;br&gt;
Expect some Loom goodies soon :)
&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/zFWQjYnb4kU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/5140491730360024549/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2013/03/what-why-eh-shush.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5140491730360024549?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5140491730360024549?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/zFWQjYnb4kU/what-why-eh-shush.html" title="What? Why? Eh? Shush!" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2013/03/what-why-eh-shush.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEECQ304eyp7ImA9WhNWE00.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-6208069780766898695</id><published>2012-12-12T08:57:00.000Z</published><updated>2012-12-12T08:57:42.333Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-12T08:57:42.333Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ABE" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="Additive Blend Editor" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Additive Blend Editor Pt. 4</title><content type="html">I've been busy with work lately, but managed to get a minor update done to the editor:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://dl.dropbox.com/u/32204670/alphaed.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="500" src="https://dl.dropbox.com/u/32204670/alphaed.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Layers now working correctly&lt;/li&gt;
&lt;li&gt;Basic animation support&lt;/li&gt;
&lt;li&gt;Select/copy functionality complete&lt;/li&gt;
&lt;/ul&gt;
Next up is separating the main editor window to enable images to be easily viewed in different sizes along with spritesheet support. &amp;nbsp;Once I'm happy with that I'll finish the animation code and add a few more tools.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/kgF9Umyw5Bo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/6208069780766898695/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/12/additive-blend-editor-pt-4.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/6208069780766898695?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/6208069780766898695?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/kgF9Umyw5Bo/additive-blend-editor-pt-4.html" title="Additive Blend Editor Pt. 4" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/12/additive-blend-editor-pt-4.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMHRHo9fip7ImA9WhNXFkg.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-4306989313455905776</id><published>2012-12-04T20:20:00.001Z</published><updated>2012-12-04T20:20:35.466Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-04T20:20:35.466Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="Minecraft" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Port to PlayMyCode of Notch's Minecraft 4kjs demo</title><content type="html">Direct port to PlayMyCode of Notch's wonderful Minecraft 4k Javascript/HTML5 demo.
&lt;br&gt;
Warning: This version runs incredibly slowly!  I've asked the PlayMyCode developers for help in finding the issue, so hopefully it will run speedily soon :)
&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/minecraft-4k-demo" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/_7KtJJb66Mw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/4306989313455905776/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/12/port-to-playmycode-of-notchs-minecraft.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/4306989313455905776?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/4306989313455905776?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/_7KtJJb66Mw/port-to-playmycode-of-notchs-minecraft.html" title="Port to PlayMyCode of Notch's Minecraft 4kjs demo" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/12/port-to-playmycode-of-notchs-minecraft.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQBSH48fip7ImA9WhNREU8.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-494054808736184316</id><published>2012-11-05T13:32:00.001Z</published><updated>2012-11-05T13:32:39.076Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-05T13:32:39.076Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><category scheme="http://www.blogger.com/atom/ns#" term="Effects" /><title>The Wigglers</title><content type="html">I seem to have this thing for tentacles lately, so here's another tentacle type demo on PlayMyCode.com :)

&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/wigglers" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;

&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/nQGHBcJ83XI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/494054808736184316/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/11/the-wigglers.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/494054808736184316?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/494054808736184316?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/nQGHBcJ83XI/the-wigglers.html" title="The Wigglers" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/11/the-wigglers.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EERH89eSp7ImA9WhNTEkw.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-416898886738592506</id><published>2012-10-14T13:59:00.000+01:00</published><updated>2012-10-14T14:00:05.161+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-14T14:00:05.161+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><category scheme="http://www.blogger.com/atom/ns#" term="Effects" /><title>Another tentacle demo</title><content type="html">Another quick demo. Based on the tentacles from my ITopia experiment.&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/tentacular" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;

&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/m1M_HjB1O9k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/416898886738592506/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/10/another-tentacle-demo.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/416898886738592506?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/416898886738592506?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/m1M_HjB1O9k/another-tentacle-demo.html" title="Another tentacle demo" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/10/another-tentacle-demo.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEIERXs8cSp7ImA9WhNTEkw.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-5705395069371130931</id><published>2012-10-14T13:08:00.001+01:00</published><updated>2012-10-14T13:08:24.579+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-14T13:08:24.579+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Retro" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Quick Old School Demo</title><content type="html">Bored this morning, so knocked up a quick old school demo-scene thing with added spikes for good measure ;)&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/old-school-tunnel" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;

&lt;br /&gt;
If it runs a little slow for you, then jump to the edit page for the above demo and click Run - for some reason it runs a bit quicker in there.&lt;br /&gt;
&lt;br /&gt;
Also, try adjusting some of the parameters - reducing NUMSEGMENTS will speed it up quite a bit.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/nf5HKPoW7zU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/5705395069371130931/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/10/quick-old-school-demo.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5705395069371130931?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5705395069371130931?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/nf5HKPoW7zU/quick-old-school-demo.html" title="Quick Old School Demo" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/10/quick-old-school-demo.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIHQXkzeSp7ImA9WhJaGEw.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-7219458657201888590</id><published>2012-10-09T21:21:00.001+01:00</published><updated>2012-10-09T21:28:50.781+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-09T21:28:50.781+01:00</app:edited><title>PayPal Warning!</title><content type="html">I normally refrain from any sort of personal blogging etc, but I felt it necessary to inform others of what just happened to me as it may possibly impact them.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Do PayPal, or possibly Domino's Pizza Online (UK) have a security issue?&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
So today I ordered a pizza using Domino's (UK) online website. &amp;nbsp;We've used it a fair few times and have almost always paid using PayPal (yes, I know - boo me, but it's easier than re-entering credit card details).&lt;br /&gt;
&lt;br /&gt;
We chose the pizza, clicked order and went through to the PayPal site, logged in and then clicked on Pay Now. &amp;nbsp;As I did, I glanced at the delivery address and something struck me - it wasn't right! &amp;nbsp;Too late though, the order had gone through!&lt;br /&gt;
&lt;br /&gt;
At this stage I was incredibly concerned and immediately logged into my PayPal account. &amp;nbsp;To my horror, the transaction appeared showing some bizarre address in Ireland! &amp;nbsp;I checked my account profile and addresses - no such address linked with my account and no other strange or worrying activity. &amp;nbsp;Hmm. &amp;nbsp;I immediately changed my password just in case.&lt;br /&gt;
&lt;br /&gt;
Once done, I went back to the Domino's website and tried another transaction - but this time, instead of hitting Pay Now on the PayPal screen, I took a screenshot:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://dl.dropbox.com/u/32204670/dominos1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="402" src="https://dl.dropbox.com/u/32204670/dominos1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Again, the very same, and COMPLETELY UNKNOWN TO ME, address appeared!&lt;br /&gt;
&lt;br /&gt;
And here's the snapshot from my PayPal account page for the pizza I ordered:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://dl.dropbox.com/u/32204670/dominos2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="610" src="https://dl.dropbox.com/u/32204670/dominos2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
So as you can see, the delivery address went through as this odd one.&lt;br /&gt;
&lt;br /&gt;
I called Domino's to confirm the delivery address - they assured me that the address they use is the one on their system - not the one from PayPal. &amp;nbsp; All good (and the pizza did arrive on time - and was quite yummy!).&lt;br /&gt;
&lt;br /&gt;
However, the issue still remains - who the hell is this Andy bloke and what's this strange address?&lt;br /&gt;
&lt;br /&gt;
Let me just record this here: I know only one person in Ireland and they live nowhere near Navan - and they have nothing to do with my PayPal account, nor have I ever sent anything to them (outside of a Christmas card!).&lt;br /&gt;
&lt;br /&gt;
So, I called PayPal. &amp;nbsp;They were very approachable and clearly understood my concerns. &amp;nbsp;They confirmed that the address was recorded in their system as a "gift address". &amp;nbsp;I had no idea at the time what a "gift address" was so the operator explained. &amp;nbsp;In simple terms, when you make a purchase you can have the item sent to an address that's not your own, say for example sending a present to a friend.&lt;br /&gt;
&lt;br /&gt;
Pretty strange for a pizza purchase. PayPal then checked my account history and could see that this gift address was created on 27th September and was associated with another Domino's pizza we ordered that day (did I say we like pizza?). &amp;nbsp; Even stranger! &amp;nbsp;And then a clanger - this gift address was created at the same time as that order, from the same PC that placed the order! &amp;nbsp;WHAT?&lt;br /&gt;
&lt;br /&gt;
At this point I was a little dumbstruck - I couldn't possibly fathom how this could occur. &lt;br /&gt;
&lt;br /&gt;
The PayPal operator was also curious, particularly as this gift address wasn't visible in my account profile - the only address recorded is my own home address. &amp;nbsp;Their concern was that I may have had a virus, and that my virus checker was maybe very out of date or hadn't run recently.&lt;br /&gt;
&lt;br /&gt;
Nope and nope and nope on that account. &amp;nbsp;The PC used is a work laptop, belonging to a large corporate company. &amp;nbsp;The security software on there is always up-to-date and is always running (I have no control over it - it's a corporate enforced thing). &amp;nbsp;So I'm pretty flipping sure it's as secure as possible. &lt;br /&gt;
&lt;br /&gt;
PayPal recommended I delete the gift address - well, I can't as it doesn't appear in my profile! &amp;nbsp;They could see it, but I certainly couldn't (bit of a warning sign there for a start!). &amp;nbsp;So, they duly deleted it for me, and that was pretty much the end of the call.&lt;br /&gt;
&lt;br /&gt;
Only afterwards did the fully gravity of this hit me - if I'd made some major purchase for something and not really paid much attention to the delivery address - would it have been delivered to this place in Ireland?&lt;br /&gt;
&lt;br /&gt;
So I sat and thought on it for a short while and it occurred to me:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Why does this apparent "gift" address appear for any transaction I put through PayPal - even when it's clearly &lt;u&gt;not&lt;/u&gt;&amp;nbsp;a giftable transaction!&lt;/li&gt;
&lt;li&gt;Why can I &lt;b&gt;not&lt;/b&gt;&amp;nbsp;see this gift address in my profile - anywhere?&lt;/li&gt;
&lt;li&gt;If PayPal are stating that this address was recorded as a Gift Address then how did that happen? &amp;nbsp;You can't associate a pizza purchase from your local Domino's to a PayPal gift address! &amp;nbsp;Nor is there any way of doing so on the payment confirmation screen. &amp;nbsp;So how the hell could a gift address appear?&lt;/li&gt;
&lt;li&gt;Now, a quick Google of the above address, or at least some of it, reveals a curious thing - Navan was "apparently" one of the proposed locations for PayPal's base in Ireland - promising hundreds of jobs. &amp;nbsp;This was never to be the case and PayPal ended up based in Dundalk. &amp;nbsp;Probably me reading more into this than there is, but hey - some people were clearly upset about that decision:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.meathchronicle.ie/news/roundup/articles/2012/03/07/4009385-navan-was-never-in-race-for-paypal-jobs-county-manager" target="_blank"&gt;http://www.meathchronicle.ie/news/roundup/articles/2012/03/07/4009385-navan-was-never-in-race-for-paypal-jobs-county-manager&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.meathchronicle.ie/news/navan/articles/2011/12/14/4008114-war-of-words-follows-paypals-rejection-of-navan/"&gt;http://www.meathchronicle.ie/news/navan/articles/2011/12/14/4008114-war-of-words-follows-paypals-rejection-of-navan/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://newsandsport.ie/leads/read/items/answers-sought-over-paypals-navan-snub"&gt;http://newsandsport.ie/leads/read/items/answers-sought-over-paypals-navan-snub&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;makes you wonder if there's somebody inside PayPal that holds a grudge? Who knows!&lt;/li&gt;
&lt;li&gt;I guess another possibility is there's an issue with Domino's - could there be an issue with their system that's causing this bizarre address to appear? Sounds less likely to me.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
I do apologise to the person(s) living at this address in Ireland. &amp;nbsp;They may be completely innocent in this - and could potentially be receiving many items that they never expected or paid for! &amp;nbsp;I'm pretty certain they'd be shocked at the arrival of a pizza from a knackered looking delivery driver who's come all the way from Surrey in England!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So &lt;b&gt;please&lt;/b&gt;, if you have a PayPal account and use it to pay for anything online - &lt;b&gt;double check the postal address before hitting "Pay Now"!&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
If you've also purchased anything recently, please check your PayPal confirmation emails, or log into PayPal and check the history.&lt;br /&gt;
&lt;br /&gt;
I'm going to send this same post to UK Police for them to investigate, and to PayPal and Domino's for comment. &amp;nbsp;I'll post an update if I receive any reply.&lt;br /&gt;
&lt;br /&gt;
And off I go to have a beer and watch some TV, safe in the knowledge that my PayPal account is secure. &amp;nbsp;Or is it?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/V2p5HQI3j-w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/7219458657201888590/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/10/paypal-warning.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/7219458657201888590?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/7219458657201888590?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/V2p5HQI3j-w/paypal-warning.html" title="PayPal Warning!" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/10/paypal-warning.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0IDSX8-cCp7ImA9WhJaEkQ.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-8734014642048601604</id><published>2012-10-03T20:12:00.001+01:00</published><updated>2012-10-03T20:12:58.158+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-03T20:12:58.158+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ABE" /><category scheme="http://www.blogger.com/atom/ns#" term="Additive Blend Editor" /><category scheme="http://www.blogger.com/atom/ns#" term="Effects" /><title>Additive Blend Editor Pt 3</title><content type="html">A little more work on the editor today:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://dl.dropbox.com/u/32204670/craped5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="500" src="https://dl.dropbox.com/u/32204670/craped5.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Now able to save the project (useful feature!)&lt;/li&gt;
&lt;li&gt;Save a selection of the display as an image/sprite&lt;/li&gt;
&lt;li&gt;Copy a selection of the display to create a new brush (also saved to disk for future use)&lt;/li&gt;
&lt;li&gt;Building the GUI up a little more&lt;/li&gt;
&lt;li&gt;Introduced layers (although still not happy with the result yet)&lt;/li&gt;
&lt;/ul&gt;
Also started work on a selection tool - picking one or more "points" that you've placed so you can alter/move/delete - but oh my! Is that an interesting problem to solve! &amp;nbsp;When each point is an image that can have varying differences including scale/angle you can end up with big bounding boxes that don't reflect the point you're choosing. &amp;nbsp;There's also the issue of selecting the correct point when there's a lot of points available in one area - no idea how to address this yet :)&lt;br /&gt;
&lt;br /&gt;
Few more tweaks/fixes and I'll start to use it for generating real game sprites :)&lt;br /&gt;
&lt;br /&gt;
If anybody's interested in trying this tool out then feel free to let me know.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/5fIjxgzYfjQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/8734014642048601604/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/10/additive-blend-editor-pt3.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/8734014642048601604?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/8734014642048601604?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/5fIjxgzYfjQ/additive-blend-editor-pt3.html" title="Additive Blend Editor Pt 3" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/10/additive-blend-editor-pt3.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcNSHY8eCp7ImA9WhJaEU4.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-623908999218077444</id><published>2012-10-01T18:04:00.002+01:00</published><updated>2012-10-01T23:21:39.870+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-01T23:21:39.870+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ABE" /><category scheme="http://www.blogger.com/atom/ns#" term="Additive Blend Editor" /><category scheme="http://www.blogger.com/atom/ns#" term="Effects" /><title>Additive Blend Editor Pt 2</title><content type="html">Managed to find a little free time to work on the Additive Blend Editor. &amp;nbsp;I've moved away from it being available on PlayMyCode and instead written it for Windows/OSX/Linux. &amp;nbsp;This decision was mainly due to the inability to save your work anywhere.&lt;br /&gt;
&lt;br /&gt;
A few hours work and we've got a very basic&amp;nbsp;GUI&amp;nbsp;under way&amp;nbsp;and most of the basic tools:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://dl.dropbox.com/u/32204670/craped1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="497" src="https://dl.dropbox.com/u/32204670/craped1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://dl.dropbox.com/u/32204670/craped2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="498" src="https://dl.dropbox.com/u/32204670/craped2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Long ways to go yet, but the basics are there and working. &amp;nbsp;The idea is to allow you to save to a .png and/or an XML data file which you can then use to render the same designs in your game.&lt;br /&gt;
&lt;br /&gt;
There's also scribbled down ideas for animation, but that's not too high on the priority list.&lt;br /&gt;
&lt;br /&gt;
If you've got any suggestions then please leave a comment.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/Xt9YeGGIxb4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/623908999218077444/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/10/additive-blend-editor-pt-2.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/623908999218077444?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/623908999218077444?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/Xt9YeGGIxb4/additive-blend-editor-pt-2.html" title="Additive Blend Editor Pt 2" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/10/additive-blend-editor-pt-2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkAFR349fSp7ImA9WhJUEU4.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-7134871748550797725</id><published>2012-09-08T21:05:00.000+01:00</published><updated>2012-09-08T21:05:16.065+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-08T21:05:16.065+01:00</app:edited><title>Indie dev grant - get on it!</title><content type="html">Ok, here's a thing...&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://www.kyttarogames.com/?p=220"&gt;http://www.kyttarogames.com/?p=220&lt;/a&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you're an indie and looking for funding to help you get your game finished then you should read the above and apply - you never know, it could be you receiving a potentially large chunk of cash to help you out!&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The grant is tied to the Bundle in a Box and for every 15,000 bundles sold $2000.00 will be added to the grant. The lucky dev will walk away with all of the grant money - no strings attached.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So yeah, if you need it - read it, get on it and good luck!&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/H2tyrnLsozE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/7134871748550797725/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/09/indie-dev-grant-get-on-it.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/7134871748550797725?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/7134871748550797725?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/H2tyrnLsozE/indie-dev-grant-get-on-it.html" title="Indie dev grant - get on it!" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/09/indie-dev-grant-get-on-it.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8MSXY6cCp7ImA9WhJWGEw.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-8589725880356741703</id><published>2012-08-24T13:54:00.005+01:00</published><updated>2012-08-24T13:54:48.818+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-24T13:54:48.818+01:00</app:edited><title>Still here!</title><content type="html">Oops! &amp;nbsp;Been a little while since I updated this blog. &amp;nbsp;Hopefully there will be something interesting appearing soon :)&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/Y7PVUDi3ack" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/8589725880356741703/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/08/still-here.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/8589725880356741703?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/8589725880356741703?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/Y7PVUDi3ack/still-here.html" title="Still here!" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/08/still-here.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYER3s5cSp7ImA9WhVbEk0.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-5358104521860776085</id><published>2012-05-28T12:21:00.000+01:00</published><updated>2012-05-28T12:21:46.529+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-28T12:21:46.529+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Retro" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><category scheme="http://www.blogger.com/atom/ns#" term="Asteroids" /><title>Asteroids</title><content type="html">A version of the Atari classic Asteroids built using PlayMyCode.&lt;br /&gt;
&lt;br /&gt;
Click on the image to play, or on the PlayMyCode banner to take you to the game, and source code.&lt;br /&gt;
&lt;br /&gt;
Enjoy :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/asteroids" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
Arrow keys to move, Z to fire and X or Space to perform a Hyperspace Jump!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/OB6zEQRFzu8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/5358104521860776085/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/05/asteroids.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5358104521860776085?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5358104521860776085?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/OB6zEQRFzu8/asteroids.html" title="Asteroids" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/05/asteroids.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcFQX44cSp7ImA9WhVUEEw.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-3885675696707023782</id><published>2012-05-14T14:19:00.002+01:00</published><updated>2012-05-14T17:46:50.039+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-14T17:46:50.039+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="3D" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Back to 3D</title><content type="html">Having received a Raspberry Pi the other day I found myself digging around retro games. &amp;nbsp;In particular, I was playing with the original Elite and figured it would be fun to try and create a 3D space game using PlayMyCode.&lt;br /&gt;
&lt;br /&gt;
I'd already created a very basic 3D renderer for PMC (see earlier posts), so I was able to take this and improve it quite quickly:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/32204670/inspace1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="257" src="http://dl.dropbox.com/u/32204670/inspace1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This is a simple model of the Adder ship from Elite. &amp;nbsp;The 3D engine now supports lights (for which this scene has a single global light at the moment). &amp;nbsp;I've also added texture support, though not fully functional as I need context.clip() support in PMC which isn't yet available.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The colours I've chosen above are intentional and temporary - I'll choose much better colours eventually!&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;There's no clipping in the engine yet, so that's next up along with a simple particle system for engine effects :)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;EDIT:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Hmm - so I tried having 20 of the Adder ships flying around and performance was horrific! &amp;nbsp;FPS dropped down to 15FPS which is nowhere near good enough - and that's without clipping :(&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Time to dig through the code looking at ways to optimise it, or this project will end up dead in the water (or is that space!)&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Ok, so it turns out the lighting is eating up all the time!  Turned it off for now until I can find a cheaper solution :(&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/A6pMV1D6g18" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/3885675696707023782/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/05/back-to-3d.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/3885675696707023782?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/3885675696707023782?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/A6pMV1D6g18/back-to-3d.html" title="Back to 3D" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/05/back-to-3d.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYAQ3kzcCp7ImA9WhVVFUw.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-2997890132075832220</id><published>2012-05-08T22:55:00.000+01:00</published><updated>2012-05-08T22:55:42.788+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-08T22:55:42.788+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Procedurally Generated Caves Redux</title><content type="html">Looking back over some of my older projects that needed some tidying up or finishing, I realised I'd not applied tiles to the Procedurally Generated Caves demo (as posted earlier). &lt;br /&gt;
&lt;br /&gt;
So, here's an updated version that includes some basic tiles that have been implemented in a very very cute way - read: not the usual method of having hundreds of painful nested if/else statements:&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/tiled-procedural-caves" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
I wanted to have a better method than the "usual" so did a little digging around the net and found the following resource:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href="http://www.saltgames.com/2010/a-bitwise-method-for-applying-tilemaps/" target="_blank"&gt;http://www.saltgames.com/2010/a-bitwise-method-for-applying-tilemaps/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
It took me less than five minutes to apply this method to the original demo and it works beautifully. &amp;nbsp;Huge thanks to Sam Driver for this (Note: I've also pinched the tile graphics he used - hope he doesn't mind!)&lt;br /&gt;
&lt;br /&gt;
Since then, I've also found the following resource which goes into more detail regarding this bit-mask method (and in particular, how to use it for more types of blocks):&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href="http://www.angryfishstudios.com/2011/04/adventures-in-bitmasking/" target="_blank"&gt;http://www.angryfishstudios.com/2011/04/adventures-in-bitmasking/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Press the PLAY MY CODE link on the bar above to see the code for the demo.&lt;br /&gt;
&lt;br /&gt;
I've already started to turn this into a game so we'll see how that progresses, but first - I need to finish the Swarm game :)&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/clGqWRGm1gI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/2997890132075832220/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/05/procedurally-generated-caves-redux.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/2997890132075832220?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/2997890132075832220?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/clGqWRGm1gI/procedurally-generated-caves-redux.html" title="Procedurally Generated Caves Redux" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/05/procedurally-generated-caves-redux.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8EQ30zeyp7ImA9WhVWGEo.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-997520478571081426</id><published>2012-05-01T13:20:00.000+01:00</published><updated>2012-05-01T13:20:02.383+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-01T13:20:02.383+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>PlayMyCode Mobile Demo</title><content type="html">The PlayMyCode chaps recently ran a demonstration of PlayMyCode at @momobrum (unfortunately, I didn't know about it in time so wasn't able to attend).  However, they did enable, albeit an experimental, version of PlayMyCode that supports mobile devices.&lt;br /&gt;
&lt;br /&gt;
I tried this out with a few of my previous demo's and figured I'd make one that was a little more suited:&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/pmc-balls" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
It works fine on iOS devices, but I was experiencing issues using the default browser on the Samsung Galaxy S - the demo shows up, but touch actions don't get picked up. &amp;nbsp;I'm sure this will get fixed soon as it's early days.&lt;br /&gt;
&lt;br /&gt;
Well done to Joe and Seb at PlayMyCode for pushing their incredible site to new areas.&lt;br /&gt;
&lt;br /&gt;
Now, if they could just add "context.clip" support then I could finish some texture mapping :D&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/D7peDAXeD_E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/997520478571081426/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/05/playmycode-mobile-demo.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/997520478571081426?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/997520478571081426?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/D7peDAXeD_E/playmycode-mobile-demo.html" title="PlayMyCode Mobile Demo" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/05/playmycode-mobile-demo.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8ESHYzfyp7ImA9WhVWFU8.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-2363729561123820987</id><published>2012-04-27T12:59:00.001+01:00</published><updated>2012-04-27T13:13:29.887+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-27T13:13:29.887+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><category scheme="http://www.blogger.com/atom/ns#" term="PMC Tutorials" /><title>How Itopia works on PlayMycode</title><content type="html">I'd originally intended to make Itopia into a game on PlayMyCode, but unfortunately, HTML5 performance isn't quite good enough (and is seriously rubbish when using Firefox!) to warrant any further development.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/itopia" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead I've moved it over to a desktop version (using libGDX) and will continue from there.&lt;br /&gt;
&lt;br /&gt;
I did quickly try the same effect in the Swarm game I'm working on, and it looks smashing:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://dl.dropbox.com/u/32204670/swarm_z1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="257" src="http://dl.dropbox.com/u/32204670/swarm_z1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
An image doesn't really do this justice - it looks absolutely lovely in motion :)&lt;br /&gt;
&lt;br /&gt;
Unfortunately, the rest of the game doesn't quite fit now:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://dl.dropbox.com/u/32204670/swarm_z2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="255" src="http://dl.dropbox.com/u/32204670/swarm_z2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
I'm now rebuilding the assets so they're more in keeping with the new look.&lt;br /&gt;
&lt;br /&gt;
But what of Itopia on PlayMyCode? &amp;nbsp;Well, until performance improves (not a fault of PlayMyCode I might add) then, not much. &amp;nbsp;Instead, I've decided to break the code down here for anybody that's interested. &lt;br /&gt;
&lt;br /&gt;
Have fun :)&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;






Project Assets:&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
There's two main images used in this project:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; blob.png
&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; boomerspawn_spr.png&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
blob.png is used for almost everything in the demo! It's just shaped to do what we want. &amp;nbsp;Boomerspawn_spr is used to give the "head" of the red devil a more defined look. It's quite amazing what you can do with limited assets :)&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The music is called &lt;i&gt;Factor&lt;/i&gt;&amp;nbsp;and is by the talented &lt;i&gt;Deceased Superior Technician&lt;/i&gt;. &amp;nbsp;You can find a lot more of his music here:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href="http://nosoapradio.us/" target="_blank"&gt;NoSoapRadio&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
His music is free for any use (even commercial) - all you have to do is credit him appropriately :)&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;






Code Structure:&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
The code is structured in the same way as I do all my projects on PMC. &amp;nbsp;There's the globals at the top, followed by the main game loop, defined by the &lt;b&gt;onEachFrame() do |delta|&lt;/b&gt;&amp;nbsp;. The remainder of the code comprises all of the classes used (described below).&lt;br /&gt;
&lt;br /&gt;
There's a couple of points to make before delving into the classes...&lt;br /&gt;
&lt;br /&gt;
1) There's an empty image asset called $mainCanvas that has the same dimensions as the screen. &amp;nbsp;Everything is drawn to this image rather than the main PMC canvas - hence why you'll see its definition being passed between classes/methods. &amp;nbsp;This is often termed as a "back-buffer". When everything has been drawn to this canvas, it is itself drawn to the main PMC canvas. &amp;nbsp;But why? Isn't this wasteful? &amp;nbsp;Well, yes it is a little and for the purposes of the Itopia demo, it could be removed. &amp;nbsp;However, I'd planned to use it to do other effects such as motion blur or other post-processing effects. It's up to you if you keep it like that or not :)&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
2) You'll notice the following in the globals section:&lt;br /&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;code&gt;$blob &amp;nbsp; &amp;nbsp; &amp;nbsp; = new Image("blob.png")&lt;br /&gt;$blobR &amp;nbsp; &amp;nbsp; &amp;nbsp;= tintImage($blob, :red)&lt;br /&gt;$blobB &amp;nbsp; &amp;nbsp; &amp;nbsp;= tintImage($blob, :blue)&lt;br /&gt;$blobG &amp;nbsp; &amp;nbsp; &amp;nbsp;= tintImage($blob, :green)&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
This code is pretty interesting and is something that Joe (one of the PMC developers) showed me. &amp;nbsp;It turns out that the setColor(...) and drawImage(...) functions, when combined, are &lt;i&gt;very expensive&lt;/i&gt;&amp;nbsp;in performance terms. &amp;nbsp;Instead of using setColor() it's better to pre-colour your images. &lt;br /&gt;
&lt;br /&gt;
Above, we have the original blob image and then Red, Blue and Green versions - created using the following &lt;i&gt;tintImage()&lt;/i&gt;&amp;nbsp;function:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
def tintImage( img, colour )&lt;br /&gt;
&amp;nbsp; &amp;nbsp; temp = new Image( img.getWidth(), img.getHeight() )&lt;br /&gt;
&amp;nbsp; &amp;nbsp; temp.setColor( colour )&lt;br /&gt;
&amp;nbsp; &amp;nbsp; temp.drawImage( img, 0, 0 )&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; return temp&lt;br /&gt;
end&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;Now, instead of using setColor() within the main code, we just use one of the pre-coloured images instead.&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;The main loop provides one parameter, &lt;i&gt;delta&lt;/i&gt;&amp;nbsp;in its block and is used to adjust the timings for entity movement. (see getDelta() in the reference documents).&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;The main loop clears the screen, ready for rendering and then also clears out the temporary canvas:&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;fill(0, 0, 0)&lt;br /&gt;$mainCanvas.clear()&lt;br /&gt;$mainCanvas.fill(20, 20, 40, 1.0)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;$mainCanvas.setBlend(:add)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;The &lt;i&gt;setBlend(:add)&lt;/i&gt;&amp;nbsp;is important here. &amp;nbsp;This defines that we want to use &lt;i&gt;additive blending&lt;/i&gt;&amp;nbsp;when drawing images. &amp;nbsp;Additive Blending is where the RGB colour elements of one image are added to the RGB elements of overlapping images. &amp;nbsp;If the two images are identical (in terms of colour) then when overlapping they will become brighter. &amp;nbsp;Itopia uses this to great effect, but the downside is the cost in performance. &amp;nbsp;In the demo, try creating a large number of jellyfish - you'll soon see the FPS plummet!&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;if ($controls.isLeftPressed())&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; $game.addJelly($controls.getMouseX(), $controls.getMouseY())&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;end&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;if ($controls.isRightPressed())&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; $game.addRedDevil($controls.getMouseX(), $controls.getMouseY())&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;end&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;The above lines instruct the game class to add a new entity - a jelly if the left mouse button is pressed and a red devil if the right mouse button is pressed. &amp;nbsp;&lt;/span&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;$game.update(delta)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;$game.render()&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;The above informs the game object that it must update and then render all of the entities it knows about.&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;setColor(:white)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;drawImage($mainCanvas, 0, 0, false)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style="font-family: 'Times New Roman';"&gt;These last lines draw our temporary canvas to the screen.&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;







Game class&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The game class is the controller for all of the entities and related actions. &amp;nbsp;Itopia isn't really a game yet, so this is fairly simple.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You'll see that in the globals section (at the very top of this project) is the creation of an instance of this class:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;$game = new Game()&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
This is then accessed from within the main loop, the key elements being the update/render calls.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
def new()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Array that will contain all our entities (Jelly or RedDevil)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @entities &amp;nbsp; &amp;nbsp; = []&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @numEntities &amp;nbsp;= 0&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Create a new instance of our background particles (max of 100 particles)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @dust &amp;nbsp; &amp;nbsp; &amp;nbsp; = new Dust(100)&lt;br /&gt;
end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
The constructor for the game class defines an empty array for all of the entities. &amp;nbsp;As the Jelly and RedDevil classes are actually sub-classes of Entity, we can manage them as Entity classes - no need for separate arrays for each type.&lt;br /&gt;
&lt;br /&gt;
We also create an instance of the Dust particle generator.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
def update(delta)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @entities.eachIndex() do |i|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @entities[i].update(delta)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
In any &lt;i&gt;update&lt;/i&gt;&amp;nbsp;operation I'll tend to use the &lt;i&gt;eachIndex()&lt;/i&gt;&amp;nbsp;operation rather than &lt;i&gt;each()&lt;/i&gt;. This is a habit I've developed as an update in one of the classes could cause the array I'm iterating over to change (could even delete entries from it!). &amp;nbsp;eachIndex() handles this case so there's no nasty issues lurking here :)&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;code&gt;
def render()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @dust.render($mainCanvas)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @entities.each() do |e|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; e.render($mainCanvas)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
end&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&lt;/code&gt;
The above issues a render call to the dust particle generator first as we don't want these particles appearing in front of the jelly's. &amp;nbsp;One improvement could be in this area - use 3D perspective projection and have these particles in 3D along with the jelly's :)&lt;br /&gt;
&lt;br /&gt;
Note, unlike the &lt;i&gt;update()&lt;/i&gt;&amp;nbsp;function, the &lt;i&gt;render()&lt;/i&gt;&amp;nbsp;function doesn't use &lt;i&gt;eachIndex&lt;/i&gt;&amp;nbsp;but uses &lt;i&gt;each&lt;/i&gt;&amp;nbsp;instead. This is because all updates have finished so no objects will be added/removed from the array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The remainder of this class is just helper methods that are used to add or remove new entities, be them jellyfish or red devils.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;








Entity class&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In game development, it's often the norm to create an &lt;i&gt;Entity&lt;/i&gt;&amp;nbsp;class that encompasses many of the common elements associated with (most, but not all) of your game "things". &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In Itopia, we have the Jelly and the Red Devil. &amp;nbsp;Both of these are entities and exhibit similar characteristics. &amp;nbsp;Now, it would be pretty silly to have the identical code in these classes for such things as location, velocity etc. &amp;nbsp;Instead, we have an Entity class that includes all of these common parameters.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
The class itself should hopefully be fairly explanatory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;








Jelly class&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ok, time for the interesting bits!&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
def new(x, y)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Pass the initial parameters to the parent Entity&lt;br /&gt;
&amp;nbsp; &amp;nbsp; super(x, y, 1, 1)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // The array of tentacles for this jelly&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @tentacles = []&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Create three tentacles with random lengths, speeds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @tentacles.push(new Tentacle(x, y, rand(0, 5), rand(15, 25)))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @tentacles.push(new Tentacle(x, y, rand(10, 15), rand(15, 25)))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @tentacles.push(new Tentacle(x, y, rand(20, 35), rand(15, 25)))&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // The movement of the jelly is defined by a simple math equation. Time is&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // a function of this equation and having a random value will position&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // the jelly at a different location to previous ones&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @time &amp;nbsp;= rand(0, 1000)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Speed of this jelly&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @speed = rand(0.1, 0.6)&lt;br /&gt;
end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
The above is the constructor for the Jelly class. &amp;nbsp;As it's a sub-class of Entity, the first thing we do is pass the initial parameters to the constructor of the Entity. &amp;nbsp;These are simply the X/Y location. &amp;nbsp;The velocities (VX/VY) aren't used here so we pass through 1,1&lt;br /&gt;
&lt;br /&gt;
Each jelly will have a number of tentacles attached to it. &amp;nbsp;The &lt;i&gt;@tentacles&lt;/i&gt;&amp;nbsp;array holds all of them. &lt;br /&gt;
In this demo, a jelly has three tentacles and they are created (using random length and initial time component) and pushed to the tentacle array.&lt;br /&gt;
&lt;br /&gt;
As described in the code comment, the &lt;i&gt;@time&lt;/i&gt;&amp;nbsp;variable is a function of a simple math equation that governs the movement of the jelly. &amp;nbsp;Giving it a random number has the effect of positioning the jelly at a different location.&lt;br /&gt;
&lt;br /&gt;
The &lt;i&gt;@speed&lt;/i&gt;&amp;nbsp;variable governs how quickly the jelly moves about the path defined by the math equation given in the &lt;i&gt;update()&lt;/i&gt;&amp;nbsp;function below.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
def update(delta)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Increment the time by the speed&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @time = @time + @speed&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Is it time to adjust the speed?&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if (@time.floor() / 1000 == 1)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @speed = rand(0.1, 0.9)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Calculate new X/Y positions&lt;br /&gt;
&amp;nbsp; &amp;nbsp; setY( (15 *&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(@time * -6).toRadians().cos()) +&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(240 + (180 * (@time * 1.3).toRadians().sin()) ) )&lt;br /&gt;
&amp;nbsp; &amp;nbsp; setX( (15 *&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(@time * -6).toRadians().sin()) +&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(320 + (200 * (@time / 1.5).toRadians().cos()) ) )&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Update each tentacle&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @tentacles.eachIndex() do |t|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @tentacles[t].update(X(), Y()+8, delta)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;span style="font-family: monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
This is the main update function for the Jelly. &amp;nbsp;The movement is controlled by the mathematical equation that is really just an wonky looking sine wave. &amp;nbsp;Try drawing the points generated by it and then drawing a line between them to see how it looks. &amp;nbsp;Also try adjusting some of these values to see what happens!&lt;br /&gt;
&lt;br /&gt;
Once the new position has been calculated, each of the tentacles are updated - the head of each tentacle is always at the same position as the head of the jelly.&lt;br /&gt;
&lt;br /&gt;
And finally, we draw the jelly&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
def render(canvas)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Draw all the tentacles&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @tentacles.eachIndex() do |t|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @tentacles[t].render(canvas)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Draw a blob for the head of the jelly&lt;br /&gt;
&amp;nbsp; &amp;nbsp; canvas.setAlpha(0.3)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; canvas.drawImage($blobB, X(), Y(), 96, 64, true)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; canvas.drawImage($blobB, X(), Y(), 64, 56, true)&lt;br /&gt;
end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
The tentacles are drawn first (by issuing a render() call on each tentacle). &amp;nbsp;Following this, a couple of (fairly dim) blue blobs are drawn to define the head of the jelly. &amp;nbsp;This should really look a lot better, but is ok for a first attempt!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;








Tentacle class&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The tentacle class is probably the most complicated part of the project, but even so, is still very simple.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you want a better understanding of the math used in both this and the Jelly class, try breaking each of the movement equations down and plotting them out.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Playing with the numbers within here can end up with some pretty wacky behaving tentacles!&lt;br /&gt;
&lt;br /&gt;
I'll break the update function down here to help explain it better:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
def update(headX, headY, delta)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Increment time by a fixed amount (not too fast)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @t = @t + 0.005&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Set the first node of the tentacle to be the position of the jelly head&lt;br /&gt;
&amp;nbsp; &amp;nbsp; @nodes[0] = [headX, headY]&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
As with the jelly class, the movement is partially controlled by a function of time. This time is incremented based on the speed of tentacle movement (which in this case is fixed at 0.005).&lt;br /&gt;
&lt;br /&gt;
The very first node of the tentacle must always be the same as the head of the jelly - otherwise it would look pretty strange, having tentacles appearing all over the place!&lt;br /&gt;
&lt;br /&gt;
The position of all subsequent nodes of this tentacle are updated based on the position of the first node. &amp;nbsp;The following loop iterates over each node (except the first one as that was defined above).&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; // Update subsequent nodes&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 1.upTo(@numNodes) do |i|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; distX = @nodes[i-1][0] - @nodes[i][0]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; distY = @nodes[i-1][1] - @nodes[i][1]&lt;br /&gt;
&lt;br /&gt;
// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dist &amp;nbsp;= ((distX * distX) + (distY * distY)).sqrt()&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Simple method to calculate the distance between two points. Not very accurate&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // but a lot faster than the sqrt() method above&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (distX*distY &amp;lt; 0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dist = distX-distY&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dist = distX+distY&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
Ok, the above looks a little strange. &amp;nbsp;What we're trying to do here is determine the distance between the current node and the previous one. &amp;nbsp;Knowing this will allow us to move it by a small amount in the correct direction.&lt;br /&gt;
&lt;br /&gt;
The distance between two given points (x1, y1) and (x2, y2) can be calculated using a Pythagorean Theorem:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; d = square root of&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: -webkit-left;"&gt;&lt;ul&gt;&lt;/ul&gt;
&lt;/ul&gt;
&lt;div class="separator" style="clear: both; color: #FFFFFF; text-align: center;"&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/en/math/b/8/0/b804ed6889da8604faf808b3ebc40ce5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0"  src="http://upload.wikimedia.org/wikipedia/en/math/b/8/0/b804ed6889da8604faf808b3ebc40ce5.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
or in code terms:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; distance = sqrt( (x2-x1) * (x2-x1) + (y2 - y1) * (y2 - y1) )&lt;br /&gt;
&lt;br /&gt;
which can be made simpler by breaking it down as:&lt;br /&gt;
&lt;br /&gt;
xDistance = (x2-x1)&lt;br /&gt;
yDistance = (y2-y1)&lt;br /&gt;
&lt;br /&gt;
distance = ( (distanceX * distanceX) + (distanceY * distanceY) ).sqrt()&lt;br /&gt;
&lt;br /&gt;
However, you'll see in the code above that I've commented out the line with the sqrt() operation! &amp;nbsp;As performance was an issue with this demo I tried all sorts of ways to improve it. &amp;nbsp;The sqrt() operation can be fairly slow so I opted for a simpler, although prone to error and less accurate, approach.&lt;br /&gt;
&lt;br /&gt;
Based on the distance we've just calculated, we now move the node of this tentacle by a small amount (30% of the distance calculated)&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Adjust the position of this node by a small amount of the distance (30%)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @nodes[i][0] = @nodes[i][0] + (distX * 0.3)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @nodes[i][1] = @nodes[i][1] + (distY * 0.3)&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
We could just leave the movement as above, but it doesn't really look like the movement of a tentacle - I wanted something a bit more believable, so the following two lines add the necessary "wiggle factor".&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Now determine a "wiggle" factor that makes the tentacles more believable&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mX = (@t*2+15).cos() * (15 * (i-1)/(@numNodes-1) + 1*(1-(i/@numNodes)))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mY = (@t*8).sin() * (15*@mSpeed * (i-1)/(@numNodes-1) + 3 * (1-(i/@numNodes)))&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
If you imagine a sine wave and that each node of the tentacle exists at a point on this wave, then you can see that the tentacle would form what looks like a sine wave. &amp;nbsp;However, that's not so good looking on its own. &amp;nbsp;So, we adjust the phase and amplitude of the wave so that the movement is less so at the head of the tentacle and&amp;nbsp;more so&amp;nbsp;at the end. The above determines the value for the current node which is then applied:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // And update the node positions again&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @nodes[i][0] = @nodes[i][0] + mX / i&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @nodes[i][1] = @nodes[i][1] + mY / i&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
So that's the movement out of the way, but there's one last thing here. &amp;nbsp;If you look at the demo again, you'll see two bright "lights" moving down the length of the tentacle. This is actually just a change in the brightness of certain nodes as they are drawn (see render() below). &amp;nbsp;Which node is chosen to be bright, and how long they should shine for is calculated by the following logic:&lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; if (@brightTimer.isExpired())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @brightTimer = new Timer(50)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @bright = @bright + 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (@bright &amp;gt;= @numNodes)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @bright = 0&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if (@brightTimer2.isExpired())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @brightTimer2 = new Timer(70)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @bright2 = @bright2 + 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (@bright2 &amp;gt;= @numNodes)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @bright2 = 0&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
end&lt;br /&gt;
&lt;/code&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
The last part of the tentacle class is the render() function:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;code&gt;@numNodes.times() do |n|&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; s = 1 + (0.5 * (n * 25).toRadians().sin())&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; canvas.setAlpha(0.05)&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; canvas.drawImage($blobB, @nodes[n][0], @nodes[n][1], @sizeX*s, @sizeY*s, true)&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; if (n == @bright || n == @bright2)&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sz = 5&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; canvas.setAlpha(1.0)&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; canvas.drawImage($blobW, @nodes[n][0], @nodes[n][1], sz, sz*s, true)&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; else&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sz = 5&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; canvas.setAlpha(0.4)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; canvas.drawImage($blobB, @nodes[n][0], @nodes[n][1], sz, sz, true)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; end&lt;/div&gt;
&lt;div&gt;
end&lt;/div&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
This should be fairly self explanatory. &amp;nbsp;For each node of the tentacle, we draw a fairly faint blue blob, the size of which is defined by "s = 1 + (0.5 * (n * 25).toRadians().sin()". &amp;nbsp;This creates the "bulges" in the tentacle. &lt;br /&gt;
&lt;br /&gt;
If the index of the current node being drawn is the same as the @bright or @bright2 variables, then we draw the blob image with an alpha of 1.0 (making it really stand out). &amp;nbsp;If it's neither of these then we just draw a slightly dimmer blob image for this node.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;






RedDevil and RedTentacle classes&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I won't go over these here as they're very similar to the Jelly/Tentacle classes. &amp;nbsp;In fact, the RedTentacle class is a sub-class of Tentacle, but overrides the Render function to draw things a little differently.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I'll leave these two for you to figure out :)&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;

&lt;/code&gt;&lt;br /&gt;
&lt;h4&gt;






Dust and DustParticle classes&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ok, I admit - worst name for a class ever! &amp;nbsp;Dust - under the sea! &amp;nbsp;My excuse - if you can call it one, is that I was in a rush and couldn't think of a better name :)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Having a plain black background proved a little boring so I added a small effect which randomly places tiny particles all over the screen. &amp;nbsp;Each of the particles will have a random alpha level and will move about, very slowly, until it's life is over.&lt;/div&gt;
&lt;div&gt;
When a particle eventually dies, it resets itself - having new random parameters. Doing this, rather than creating a new particle, reduces the CPU overhead as we're not creating or destroying resources.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The Dust class is&amp;nbsp;merely&amp;nbsp;a container for all of the particles. &amp;nbsp;It has one render(canvas) function that will iterate over all of the particles, updating them first and then drawing them.&lt;/div&gt;
&lt;br /&gt;
Well, that's about it. &amp;nbsp;Feel free to ask any questions and I'll do my best to answer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/wdBVKvmR2ns" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/2363729561123820987/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/04/how-itopia-works-on-playmycode.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/2363729561123820987?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/2363729561123820987?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/wdBVKvmR2ns/how-itopia-works-on-playmycode.html" title="How Itopia works on PlayMycode" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/04/how-itopia-works-on-playmycode.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUHQnk6cCp7ImA9WhVXFks.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-3790870675013768454</id><published>2012-04-17T12:52:00.000+01:00</published><updated>2012-04-17T13:37:13.718+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-17T13:37:13.718+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><category scheme="http://www.blogger.com/atom/ns#" term="Effects" /><title>Itopia Jellyfish</title><content type="html">I felt a little inspired by this great little tutorial by Charlie Knight over at &lt;a href="http://www.charliesgames.com/"&gt;http://www.charliesgames.com&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href="http://www.charliesgames.com/wordpress/?p=441" target="_blank"&gt;BlobMonster Tutorial&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I used the Blob image and the Monster movement code to get the head of each Jelly to move around and then came up with some simple trig code to control the tentacles.&lt;br /&gt;
&lt;br /&gt;
Very early days and not sure exactly what I'll do with this yet, but does look kind of nice :)&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/itopia" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, the best performance is witnessed in Chrome and Safari. &amp;nbsp;Firefox and Internet Explorer exhibit rubbish performance :(&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/nZqJRayF9RE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/3790870675013768454/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/04/itopia-jellyfish.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/3790870675013768454?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/3790870675013768454?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/nZqJRayF9RE/itopia-jellyfish.html" title="Itopia Jellyfish" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/04/itopia-jellyfish.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIBRXk-fip7ImA9WhVXFks.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-5629597108515515214</id><published>2012-04-07T15:53:00.002+01:00</published><updated>2012-04-17T12:52:34.756+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-17T12:52:34.756+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Retro" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><category scheme="http://www.blogger.com/atom/ns#" term="PMC Tutorials" /><title>Creating animations in PlayMyCode</title><content type="html">Here's a short example on how to create animations for use on PlayMyCode.&lt;br /&gt;
&lt;br /&gt;
In this example, the animation is made up from one spritestrip - a single image containing all of the frames that make the animation.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://dl.dropbox.com/u/32204670/Devil2_spr_strip4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://dl.dropbox.com/u/32204670/Devil2_spr_strip4.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
There's our little pink devil! &amp;nbsp;There are four frames in total with each frame having a size of 60pixels by 60pixels. &lt;br /&gt;
&lt;br /&gt;
To get this little fellow to animate, I created a very simple class called Animation(). &amp;nbsp;You can find this class in the source code of the example below (just click on the Play My Code button)&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/Animate" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
First, we load our spritestrip image:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; $devilImage = new Image("Devil2_spr_strip4.png")&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
And then, create the animation:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; animation &amp;nbsp;= new Animation($devilImage, 4, 0, -1, 60, 60, 100, -1)&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
Ok, so what do all those numbers mean? &amp;nbsp;As mentioned previously, this animation has 4 frames. Each frame is 60x60 pixels in size&amp;nbsp;and we want to animate with a 100ms delay between frames. We also&amp;nbsp;want it to loop forever.&lt;br /&gt;
&lt;br /&gt;
So:&lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; $devilImage &amp;nbsp; - the image containing the animated frames&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - the number of frames&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - the starting frame&lt;br /&gt;
&amp;nbsp; &amp;nbsp; -1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- the end frame (we give -1 here so that it uses all frames&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 60 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- each frame is 60 pixels wide&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 60 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- each frame is 60 pixels high&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 100 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - the delay (in milliseconds) between each frame&lt;br /&gt;
&amp;nbsp; &amp;nbsp; -1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- loop the animation forever&lt;br /&gt;
&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
All that's left is to update and draw the animation. &amp;nbsp;Both of these operations are done within the main game loop (onEachFrame):&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&amp;nbsp; &amp;nbsp; animation.update(delta)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; animation.draw(100, 100, true)&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
The animation.update(delta) will automatically manage all of the image manipulation for you. &lt;br /&gt;
&lt;br /&gt;
Take a look through the Animation() class as there's a few other methods that allow greater flexibility, such as drawing a scaled/rotated image, stopping/restarting the animation etc.&lt;br /&gt;
&lt;br /&gt;
The animation class doesn't take a copy of the source image so it's fairly memory efficient. &amp;nbsp;Just declare your images as globals first.&lt;br /&gt;
&lt;br /&gt;
Any questions, then feel free to ask :)&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/eHuB_-NnFa8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/5629597108515515214/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/04/creating-animations-in-playmycode.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5629597108515515214?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5629597108515515214?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/eHuB_-NnFa8/creating-animations-in-playmycode.html" title="Creating animations in PlayMyCode" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/04/creating-animations-in-playmycode.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08EQX46fSp7ImA9WhVbEUQ.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-43621186890375955</id><published>2012-03-26T15:57:00.001+01:00</published><updated>2012-05-28T11:10:00.015+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-28T11:10:00.015+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>PlayMyCode Tips</title><content type="html">Here's some tips for PlayMyCode that relate to features not yet available:&lt;br /&gt;
&lt;br /&gt;
So, let's say you have two strings:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
myString1 = "123"&lt;br /&gt;
myString2 = "45.67"&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
Currently, there's no defined command to allow you to convert these strings to either integer or floating point values. &amp;nbsp;However, all is not lost as you can use some fancy bit manipulation for which I've put together two helper functions below:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
// Convert the given String to an integer&lt;br /&gt;
def toInteger(string)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return string | 0&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
// Convert the given String to a floating point number&lt;br /&gt;
def toFloat(string)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return string ** 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;/code&gt;
And here's what happens with our original Strings:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
myInteger = toInteger(myString1)&lt;br /&gt;
console(myInteger)&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #444444; font-family: 'Helvetica Neue', sans-serif; font-size: 13px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: scroll; overflow-y: scroll; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;tbody style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;tr class="lightGreyBg user_output" style="background-attachment: initial; background-clip: initial; background-color: #eeeef2; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;123&lt;/td&gt;&lt;/tr&gt;
&lt;tr class="user_output" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
myFloat = toFloat(myString2)&lt;br /&gt;
console(myFloat)&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #444444; font-family: 'Helvetica Neue', sans-serif; font-size: 13px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: scroll; overflow-y: scroll; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;tbody style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;tr class="lightGreyBg user_output" style="background-attachment: initial; background-clip: initial; background-color: #eeeef2; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;45.67&lt;/td&gt;&lt;/tr&gt;
&lt;tr class="user_output" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks to Joe at PlayMyCode for pointing the above out!&lt;br /&gt;
&lt;br /&gt;
Here's some more helper functions I knocked up for use with Strings:&lt;br /&gt;
&lt;br /&gt;
// Returns a new string that is a substring of the given string&lt;br /&gt;
&lt;code&gt;
def subString(str, startIdx, endIdx)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; val = ""&lt;br /&gt;
&amp;nbsp; &amp;nbsp; startIdx.upTo(endIdx) do |i|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c = str.getChar(i)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val = val + c&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return val&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
// Tokenize the given string and return entries in a block&lt;br /&gt;
def tokenize(str, token)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; val = ""&lt;br /&gt;
&amp;nbsp; &amp;nbsp; str.each() do |c|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (c == token)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; yield val&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val = ""&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val = val + c&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; yield val&lt;br /&gt;
end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;u&gt;Examples:&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
myString = "Hello PlayMyCode How Are You Today?"&lt;br /&gt;
tokenize(myString, " ") do |seg|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; console(seg)&lt;br /&gt;
end&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;table style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #444444; font-family: 'Helvetica Neue', sans-serif; font-size: 13px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: scroll; overflow-y: scroll; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;tbody style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;tr class="lightGreyBg user_output" style="background-attachment: initial; background-clip: initial; background-color: #eeeef2; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;Hello&lt;/td&gt;&lt;/tr&gt;
&lt;tr class="user_output" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;PlayMyCode&lt;/td&gt;&lt;/tr&gt;
&lt;tr class="lightGreyBg user_output" style="background-attachment: initial; background-clip: initial; background-color: #eeeef2; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;How&lt;/td&gt;&lt;/tr&gt;
&lt;tr class="user_output" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;Are&lt;/td&gt;&lt;/tr&gt;
&lt;tr class="lightGreyBg user_output" style="background-attachment: initial; background-clip: initial; background-color: #eeeef2; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;You&lt;/td&gt;&lt;/tr&gt;
&lt;tr class="user_output" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;Today?&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
console(subString(myString, myString.indexOf("PlayMyCode"), myString.indexOf("How")))&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #444444; font-family: 'Helvetica Neue', sans-serif; font-size: 13px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: scroll; overflow-y: scroll; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;tbody style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;tr class="lightGreyBg user_output" style="background-attachment: initial; background-clip: initial; background-color: #eeeef2; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;td style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 2px; padding-left: 3px; padding-right: 3px; padding-top: 2px; vertical-align: top;"&gt;PlayMyCode&lt;/td&gt;&lt;/tr&gt;
&lt;tr class="user_output" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
I'm sure that the PlayMyCode API will soon have these features, but for now the above will suffice.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/UYRcbzbQ9Ko" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/43621186890375955/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/03/playmycode-tips.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/43621186890375955?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/43621186890375955?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/UYRcbzbQ9Ko/playmycode-tips.html" title="PlayMyCode Tips" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/03/playmycode-tips.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08HQH0_eyp7ImA9WhVbEUQ.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-4679190585678399102</id><published>2012-03-20T09:20:00.000Z</published><updated>2012-05-28T11:10:31.343+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-28T11:10:31.343+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Collision Detection</title><content type="html">I've been asked a couple of times how the collision detection works in the Asteroids game I developed on PlayMyCode. &amp;nbsp;If you've not tried it yet, then you can find a playable link a few posts below.&lt;br /&gt;
&lt;br /&gt;
I'd originally planned to use nothing but Polygon's and a Point-In-Polygon algorithm for collision detection, but then I realised that PlayMyCode had their own collision detection features that allow pixel-perfect hit detection.&lt;br /&gt;
&lt;br /&gt;
Obviously, pixel-perfect detection wasn't going to work well with Polygon's and it's generally slow. &amp;nbsp;However, in the interest of keeping things simple I tried out a few tests and was surprised at the performance, which led me on to how the collision detection works in Asteroids now.&lt;br /&gt;
&lt;br /&gt;
Each object in the game (player ship, bullets, asteroids, UFO's etc) &lt;i&gt;is&lt;/i&gt;&amp;nbsp;rendered as&amp;nbsp;a polygon. &amp;nbsp;However, rather than drawing and managing polygons on the main canvas, they're rendered to their own separate image first. &amp;nbsp;This operation is handled inside a &lt;i&gt;Polygon&lt;/i&gt;&amp;nbsp;class.&lt;br /&gt;
&lt;br /&gt;
Having each object as an image not only keeps things at a decent rate but also means we can use the per-pixel detection that PlayMyCode provides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; // Check for a collision between this polygon and that given&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; def isCollide(poly, centered)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return isCollide(poly.Img(), poly.X(), poly.Y(), centered)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; // Check for a collision between this polygon image and that given&lt;br /&gt;
&amp;nbsp; &amp;nbsp; def isCollide(img, ix, iy, c)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (@img.isPixelOverlap(@x, @y, img, ix, iy, c))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return true&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return false&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
And well, that's basically all there is to it! &amp;nbsp;The &lt;i&gt;@img&lt;/i&gt;&amp;nbsp;is the local Polygon image to which &lt;i&gt;isPixelOverlap()&lt;/i&gt;&amp;nbsp;is called against another image (which is &lt;i&gt;every&lt;/i&gt;&amp;nbsp;single other -relevant- &lt;i&gt;Polygon&lt;/i&gt;&amp;nbsp;object in the game).&lt;br /&gt;
&lt;br /&gt;
There was one other minor thing I had to do - the asteroids are actually &lt;i&gt;filled&lt;/i&gt;&amp;nbsp;polygons, but are filled with a very faint colour so as to not be different from the surrounding black! &amp;nbsp;Why? &amp;nbsp;Well, there is a rare event, triggered by a lapse in framerate where the player ship could potentially end up &lt;i&gt;inside&lt;/i&gt;&amp;nbsp;an asteroid. &amp;nbsp;Here, the pixel overlap method would fail as their would be no collisions. &amp;nbsp;Having the asteroid filled in this way means that the player would die instantly as a collision would be detected. &amp;nbsp;Crude, but it works!&lt;br /&gt;
&lt;br /&gt;
Note: For simplicity, the bullets are all rendered as polygon images rather than pixels. &amp;nbsp;We can then extend the Polygon class and utilise its collision detection code.&lt;br /&gt;
&lt;br /&gt;
Yes, this could be improved quite a bit. &amp;nbsp;Currently, the game checks for collisions between the player and every asteroid, every bullet and every asteroid&amp;nbsp;etc.&amp;nbsp; This is somewhat costly and a better approach would be to limit the checks to objects that fall within the bounding box of the player for example.&lt;br /&gt;
&lt;br /&gt;
However, as the performance doesn't seem to be an issue and I need to finish other projects I've left this for a rainy day - it's simple enough to do and the bounding box mechanism is already in the Polygon class. :)&lt;br /&gt;
&lt;br /&gt;
Feel free to look through the code (available by clicking the CODE button on the PlayMyCode site). &lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/LZKaMu5fmC8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/4679190585678399102/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/03/collision-detection.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/4679190585678399102?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/4679190585678399102?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/LZKaMu5fmC8/collision-detection.html" title="Collision Detection" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/03/collision-detection.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08ASHozfyp7ImA9WhVbEUQ.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-7784931040321140264</id><published>2012-03-20T08:17:00.001Z</published><updated>2012-05-28T11:10:49.487+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-28T11:10:49.487+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Additive Blend Editor</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://dl.dropbox.com/u/32204670/pmcglowy.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://dl.dropbox.com/u/32204670/pmcglowy.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
A friend asked how additive blend works and how he could create some funky effects in a game. He still didn't get it even after a few pints of beer - not sure if this was me being crap at explaining or him being a bit thick :)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Anyway, I figured I'd write a demo on PlayMyCode, but it soon turned into a sort of funky sprite editor. &amp;nbsp;The above was me testing one feature out and then realising I'd spent an hour playing around! &amp;nbsp;Everything above was generated using a single image - a simple glowy circle that's stretched and mashed around to create the desired shapes. Colours and alpha applied with lots of additive blend.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The "editor" will allow you to create your own funky sprites. Then, simply place a bounding box around the one you want and select "dump". &amp;nbsp;This will dump an array of information in textual format which can be placed straight into your own PlayMyCode project. &amp;nbsp;The output will be a pre-rendered sprite instead of having to render potentially hundreds of blended images. &amp;nbsp;The framerate saving is quite significant.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It's fairly basic at the moment, but does support some basic editor features, including a grid, snap-to-grid and multiple undo levels.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Will post a working version here once I'm happy the dump feature is working as I want.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/D6RqI6KiVTs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/7784931040321140264/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/03/additive-blend-editor.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/7784931040321140264?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/7784931040321140264?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/D6RqI6KiVTs/additive-blend-editor.html" title="Additive Blend Editor" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/03/additive-blend-editor.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0ADQno-cSp7ImA9WhVbEUQ.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-5455429382152178000</id><published>2012-03-13T15:24:00.001Z</published><updated>2012-05-28T11:09:33.459+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-28T11:09:33.459+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Game" /><category scheme="http://www.blogger.com/atom/ns#" term="Retro" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><category scheme="http://www.blogger.com/atom/ns#" term="Asteroids" /><title>Retro Adventures: Asteroids</title><content type="html">Finally found some time to (almost) finish the Asteroids clone. &amp;nbsp;The collision detection is now working, leaving just the UFO's to add.&lt;br /&gt;
&lt;br /&gt;
I've tried to comment the code as thoroughly as possible so others can learn from it.&lt;br /&gt;
&lt;br /&gt;
Enjoy :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/asteroids" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
Arrow keys to move, Z to fire and X or Space to perform a Hyperspace Jump!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/WAomxj9WoLg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/5455429382152178000/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/03/retro-adventures-asteroids.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5455429382152178000?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/5455429382152178000?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/WAomxj9WoLg/retro-adventures-asteroids.html" title="Retro Adventures: Asteroids" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/03/retro-adventures-asteroids.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYCSHc5eSp7ImA9WhVVFUw.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-2177781144669621928</id><published>2012-03-04T22:36:00.000Z</published><updated>2012-05-08T22:56:09.921+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-08T22:56:09.921+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Spiral!</title><content type="html">Whilst trying to make a spiral explosion effect for the Alien Swarm remake I accidentally made this demo (the accidental stuff is always the best!)&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder="0" height="438" marginheight="0" marginwidth="0" scrolling="no" src="http://www.playmycode.com/play/embed/krakatomato/spiral" style="border-size: 0; border: none; overflow-x: hidden; overflow-y: hidden; overflow: hidden;" width="620"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Source code is available on the PlayMyCode site - just click on the Code button.&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/O_ARgUQOTuU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/2177781144669621928/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/03/whilst-trying-to-make-spiral-explosion.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/2177781144669621928?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/2177781144669621928?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/O_ARgUQOTuU/whilst-trying-to-make-spiral-explosion.html" title="Spiral!" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/03/whilst-trying-to-make-spiral-explosion.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYCSHc5fSp7ImA9WhVVFUw.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-6957974434396118809</id><published>2012-02-16T07:25:00.002Z</published><updated>2012-05-08T22:56:09.925+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-08T22:56:09.925+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Procedurally Generated Caves</title><content type="html">Very quickly thrown together demo for procedural cave generation:&lt;br /&gt;
&lt;br /&gt;
&lt;iframe width="620" height="438" src="http://www.playmycode.com/play/embed/krakatomato/procedural-caves" marginheight="0" marginwidth="0" scrolling="no" frameborder="0" style="border: none; border-size: 0; overflow: hidden; overflow-x: hidden; overflow-y: hidden;"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
Press "space" to generate further maps
&lt;br /&gt;
&lt;br /&gt;
Not finished yet, as a few more clean-up stages are needed to remove some nasty looking bits. The number of miners also needs tweaking controlling so there's some control over the size of the map.

Source code is available on the PlayMyCode site - just click on the Code button.&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/8IplWQeunlw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/6957974434396118809/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/02/procedurally-generated-caves.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/6957974434396118809?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/6957974434396118809?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/8IplWQeunlw/procedurally-generated-caves.html" title="Procedurally Generated Caves" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/02/procedurally-generated-caves.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUBQH85cCp7ImA9WhRaEEU.&quot;"><id>tag:blogger.com,1999:blog-5891832471653804912.post-373026095705050522</id><published>2012-02-12T22:03:00.000Z</published><updated>2012-02-12T22:04:11.128Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-12T22:04:11.128Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Game" /><category scheme="http://www.blogger.com/atom/ns#" term="Retro" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML5" /><category scheme="http://www.blogger.com/atom/ns#" term="PlayMyCode" /><title>Retro Adventures II</title><content type="html">Back in the 80's I owned a variety of home computers including the superb Atari 800.  The only major downside to this wonderful machine was the time it took to load a game from tape - it could literally take hours and most often than not - it would crash just before it had finished loading and you'd have to start again!&lt;br /&gt;
&lt;br /&gt;
As it was such a pain to load games, the "little loaders" were played more often - was either that or end up doing homework or chores around the house!  Of these little loaders, my all time favourite was a game called Alien Swarm by Bruce Thompson:

&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.atarimania.com/8bit/screens/alien_swarm_v06_3.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://www.atarimania.com/8bit/screens/alien_swarm_v06_3.gif" width="336" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
I never did own the original and as hard as I've tried, I've never been able to track down a retail copy.  I even attempted to track down Bruce Thompson himself, but eventually gave up.

If you want to try the original game, you can play using an Atari 800 emulator. The game is located here: &lt;a href="http://www.atarimania.com/game-atari-400-800-xl-xe-alien-swarm_202.html"&gt;Atari 800 Alien Swarm&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
My lasting memory of this game was it's unique mechanic for the use of "energy".  If you died, then it wasn't necessarily game over.  Provided you had sufficient energy (after a deduction for getting hit) then you would move on to the next wave.  Your bullets used up energy and you had to collect energy reserves to enable you to fire.&lt;br /&gt;
&lt;br /&gt;
The marauding aliens were all spawned from this one worm like creature, and were intent on stealing your energy reserves at all costs.  A variety of enemies were spawned as you progressed further and your score got higher.  Some of the enemies were absolute shits - the "smart bombs" that tracked your movement were especially annoying - particularly when a million other things were flying around you!  To make matters worse, the worm's tail would stop your bullets dead - so if you were trying to shoot down an alien that had stolen an ammo and the tail was in the way - you're out of luck!  It's gone!&lt;br /&gt;
&lt;br /&gt;
Managing your energy reserves was key.  A good strategy was one where you didn't completely fill all your energy bars to the top, but rather kept it around 1-2 bars.  The reason for this is that if you die - you lose any energy you're carrying!  In addition, 5 energy reserves are subtracted from whatever is left when you die.  If there were 5 or less reserves then, well, it was game over.&lt;br /&gt;
&lt;br /&gt;
As a sort of tribute to this game, and since I've been enjoying mucking around with PlayMyCode, I decided to re-imagine Alien Swarm.


&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://dl.dropbox.com/u/32204670/swarm10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="399" src="http://dl.dropbox.com/u/32204670/swarm10.png" width="619" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
It's still a little rough and ready and very much a work in progress, but it's getting there. &amp;nbsp;I have take a few liberties here and there too - there's no longer just the one worm to watch out for, but many (depending on how far you progress!)&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
There's also a nice little feature where you can fire up a shield (as seen above) and then go and "ram" any aliens that are on the deck and searching for energy! &amp;nbsp; The shield will also protect you from falling ammo blocks, bombs dropped by aliens, and it will also deflect bouncing bombs. &amp;nbsp;However, watch out - it won't stop the worm thing from hitting you!&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
As always, being a PlayMyCode game, it will be completely free, along with the source code!&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
I'll post a playable link when it's finished :)&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Fivesprites/~4/gnNPD4wp1uo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.fivesprites.com/feeds/373026095705050522/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.fivesprites.com/2012/02/retro-adventures-ii.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/373026095705050522?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5891832471653804912/posts/default/373026095705050522?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Fivesprites/~3/gnNPD4wp1uo/retro-adventures-ii.html" title="Retro Adventures II" /><author><name>Andy White</name><uri>https://plus.google.com/115498428500337495895</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-Vf3IKrgCBpE/AAAAAAAAAAI/AAAAAAAACQU/OauRVUQQqE8/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.fivesprites.com/2012/02/retro-adventures-ii.html</feedburner:origLink></entry></feed>
