<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2037107846963035846</id><updated>2012-02-10T03:54:55.060-08:00</updated><category term='mobile'/><category term='node.js'/><category term='tower defense'/><category term='ongamestart'/><category term='workshops'/><category term='tools'/><category term='dom'/><category term='javascript'/><category term='samsung wave'/><category term='gamedevelopment'/><category term='zombies'/><category term='Front Trends'/><category term='meetjs'/><category term='snake'/><category term='competition'/><category term='event'/><category term='spidermonkey'/><category term='puzzle'/><category term='zombie eliminator'/><category term='conference'/><category term='SGWH5'/><category term='demo'/><category term='ideone'/><category term='rhodes'/><category term='Stairs to heaven in 6.22 KB'/><category term='game development'/><category term='webkit'/><category term='tile map'/><category term='frameworks'/><category term='js'/><category term='shell'/><category term='palm pixi'/><category term='MB engine'/><category term='gamedev'/><category term='animation'/><category term='symbian'/><category term='nodeKO'/><category term='canvas'/><category term='ie hack'/><category term='facebook'/><category term='i18n'/><category term='mibbu'/><category term='other'/><category term='screen size'/><category term='10K Apart'/><category term='tutorial'/><category term='palm app catalog'/><category term='published projects'/><category term='css3'/><category term='games'/><category term='bada'/><category term='approval'/><category term='algorithm'/><category term='game'/><category term='hackers'/><category term='random number'/><category term='publishing'/><category term='jquery'/><category term='palm pre'/><category term='android'/><category term='html'/><category term='selling'/><category term='palm'/><category term='microsoft'/><category term='game mechanics'/><category term='gadugadu'/><category term='phonegap'/><category term='mozilla'/><category term='compo'/><category term='qt'/><category term='command line'/><category term='rhino'/><category term='prototype'/><category term='porting'/><category term='Impossible is nothing'/><title type='text'>Michal Budzynski</title><subtitle type='html'>code blah blah...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>59</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-665062850438962151</id><published>2012-01-17T07:50:00.000-08:00</published><updated>2012-01-17T08:03:32.847-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='conference'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='mibbu'/><category scheme='http://www.blogger.com/atom/ns#' term='meetjs'/><title type='text'>MeetJS Summit</title><content type='html'>&lt;a href="https://twitter.com/#!/Goracyi/status/158145027984461824" target="_blank"&gt;&lt;img src="http://images.virtualdesign.pl/images/975951qdal2.jpg" style="width:150px;margin:5px;float:right"/&gt;&lt;/a&gt;Last weekend, during &lt;a href="http://summit.meetjs.pl"&gt;MeetJS Summit&lt;/a&gt; in Poznań, I gave my first talk this year. It was just another great frontend event organized by Godfather of Polish web conferences, &lt;a href="http://ferrante.pl"&gt;Damian Wielgosik&lt;/a&gt;, together with &lt;a href="http://poznan.gtug.pl/"&gt;Polish GTUG&lt;/a&gt;.&lt;br /&gt;Since &lt;a href="http://technetnepal.net/blogs/ict/archive/2011/11/15/monetization-of-html5-applications-and-games.aspx"&gt;ICT Conference in Kathmandu&lt;/a&gt; in November, where I spoke for the last time in 2011 (with simple .ppt slides), something really big happened in a web conferences world. Because of &lt;a href="https://github.com/bartaz/impress.js"&gt;impress.js&lt;/a&gt;, stunning CSS 3D based presentation framework by &lt;a href="https://twitter.com/#!/bartaz"&gt;Bartek Szopka&lt;/a&gt;, it became inappropriate to use prehistoric tools like PowerPoint for creating your own slides (It has 600 Github watchers more in two weeks than CoffeeScript in more than 2 years, SIC!). And since I had just couple of days before the event, I used mine &amp; &lt;a href="http://twitter.com/sasklacz"&gt;Jakub Siemiątkowski's&lt;/a&gt; port of &lt;a href="https://twitter.com/#!/jmechner"&gt;Jordan Mechner's&lt;/a&gt; Prince of Persia as a base of my presentation. I'm quite satisfied with the result, you can check it &lt;a href="http://vdlabs.com/meetjs/"&gt;HERE&lt;/a&gt; or just click on the iframe below. It is optimized for my presentation remote so you can change the slides only using PgDown &amp; PgUp. Sometimes it needs to be refreshed, and sometimes it craches, but it's more like a prove of concept, not real life product.&lt;br /&gt;&lt;iframe width="440" height="280" src="http://vdlabs.com/meetjs/"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-665062850438962151?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/665062850438962151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2012/01/meetjs-summit.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/665062850438962151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/665062850438962151'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2012/01/meetjs-summit.html' title='MeetJS Summit'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-6568932798552747358</id><published>2011-06-26T08:10:00.000-07:00</published><updated>2011-06-26T08:24:13.938-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css3'/><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><category scheme='http://www.blogger.com/atom/ns#' term='mibbu'/><category scheme='http://www.blogger.com/atom/ns#' term='bada'/><title type='text'>NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7</title><content type='html'>Since &lt;a href="https://github.com/michalbe/mibbu"&gt;Mibbu framework&lt;/a&gt; supports CSS animations, it's good moment to create version exclusively for mobile devices, without using heavy and hard to render canvas, and with very limited JavaScript DOM interactions - CSS FTW! So I remove about 50% of code from original branch and test it on my Samsung Wave (bada has one of the best mobile browsers ever, so that was my starting point). And it simply doesn't work:&lt;br /&gt;&lt;img src="http://img221.imageshack.us/img221/4716/nma.png" width="430" alt="NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7" title="NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7"/&gt;&lt;br /&gt;After short research I saw that &lt;a href="http://www.google.com/support/forum/p/Chrome/thread?tid=59e8746723622119&amp;hl=pl"&gt;Allegro ('Polish Ebay') had the same problem on Desktop Chrome&lt;/a&gt; months ago. After couple more hours of reading documentation I found a clue, that Webkit is freaking out if you try to put HTML content into style tag. So I switch &lt;pre name="code" class="js"&gt;var cssStyle = document.createElement('style');&lt;br /&gt;    cssStyle.innerHTML = 'body { color: #000; }';&lt;/pre&gt;to &lt;pre name="code" class="js"&gt;var cssStyle = document.createElement('style');&lt;br /&gt;    cssStyle.innerText = 'body { color: #000; }';&lt;/pre&gt;and everything works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-6568932798552747358?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/6568932798552747358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/06/nomodificationallowederr-dom-exception.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6568932798552747358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6568932798552747358'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/06/nomodificationallowederr-dom-exception.html' title='NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-6921547831191072280</id><published>2011-06-24T07:53:00.000-07:00</published><updated>2011-06-24T07:59:43.347-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='css3'/><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><category scheme='http://www.blogger.com/atom/ns#' term='demo'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Few words about my CSS Nyan Cat</title><content type='html'>Last week Mozilla together with Finnish demoscene hackers organized Flame Party in capital of Finland, Helsinki. More than 100 participants worked whole day on outstanding web demos in two main categories - Single Effect and Main Demo.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/tobimcfly/5854093539/in/photostream/"&gt;&lt;img src="http://farm3.static.flickr.com/2749/5854093539_551d141672.jpg" width="430" /&gt;&lt;/a&gt;Because of nearly release of stable &lt;a href="http://www.mozilla.com/en-US/firefox/all.html"&gt;Firefox 5&lt;/a&gt;, first Mozilla's browser with CSS3 Animation support, I decide to create CSS3 demo for the Single Effect Compo.&lt;br /&gt;Since I really enjoy all that 4chan-like mems stuff, I chose Nyan Cat, as one of the most 'fresh' ones. In case you don't know it (check the progress bar!):&lt;br /&gt;&lt;iframe width="425" height="349" src="http://www.youtube.com/embed/QH2-TGUlwu4" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;I didn't use any graphics to code my &lt;a href="https://developer.mozilla.org/en-US/demos/detail/css-nyan-cat"&gt;CSS Nyan Cat&lt;/a&gt;. It is completely drawn and animated in CSS. The 'pop-tart' body is created with two rounded cornered divs and big, pink dots separated with non-breaking spaces:&lt;pre name="code" class="js"&gt;#toastBody {&lt;br /&gt;    background-color:#fad695;&lt;br /&gt;    width:100px;&lt;br /&gt;    height: 70px;&lt;br /&gt;    border: solid #000 5px;&lt;br /&gt;    border-radius: 15px;&lt;br /&gt;    padding: 2px;&lt;br /&gt;    position:absolute;&lt;br /&gt;    z-index:19;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#toastBody &gt; div {&lt;br /&gt;    width:100px;&lt;br /&gt;    height:70px;&lt;br /&gt;    border-radius: 30px;&lt;br /&gt;    background-color: #fc9dff;&lt;br /&gt;    display:block;&lt;br /&gt;    color: #da3eb9;&lt;br /&gt;    font-size: 40px;&lt;br /&gt;    line-height: 10px;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;All the animations was declared with &lt;b&gt;@-moz/webkit-keyframe&lt;/b&gt; (I wrote &lt;a href="http://michalbe.blogspot.com/2011/05/css3-animations-in-mibbu.html"&gt;a lot&lt;/a&gt; about this method before). &lt;br /&gt;&lt;br /&gt;I made couple of unusual things during development. For example, look on the cat's mouth:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img405.imageshack.us/img405/1384/nyank.png" width="430"/&gt;&lt;br /&gt;Yup, it is rotated 'E' letter:&lt;pre name="code" class="js"&gt;&amp;lt;div id="mainHead" class="skin"&amp;gt;&lt;br /&gt;    &amp;lt;div class="mouth"&amp;gt;E&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;.mouth {&lt;br /&gt;    position: absolute;&lt;br /&gt;    -moz-transform: scale(2, 0.7) rotate(-90deg);&lt;br /&gt;    -webkit-transform: scale(2, 0.7) rotate(-90deg);&lt;br /&gt;    font-family: Arial;&lt;br /&gt;    font-size: 25px;&lt;br /&gt;    font-weight: bold;&lt;br /&gt;    top:9px;&lt;br /&gt;    left:37px;&lt;br /&gt;    color: #000;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;What about the rainbow behind the cat? I just cropped part of original image, put it into &lt;a href="http://www.colorzilla.com/gradient-editor/"&gt;CSS Gradient Editor by ColorZilla&lt;/a&gt; (awesome tool BTW, but still without couple of necessary features I use daily; I think I will create something like this on my own), which generates me css gradient ready for pasting into the div background:&lt;pre name="code" class="js"&gt;.rainbow {&lt;br /&gt; position:absolute;&lt;br /&gt; width:45px;&lt;br /&gt; height:90px; &lt;br /&gt; background: -moz-linear-gradient (top, #d91a12 15%, #e13300 15%, #ff7f14 16%, #f2ab03 32%, #ebc000 32%, #fade00 33%, #efff03 48%, #56fc02 49%, #52ff01 66%, #4ade7e 67%, #3baaf2 67%, #3baaf2 84%, #7337f7 84%, #6b40f2 100%);&lt;br /&gt;}&lt;/pre&gt;The most annoying thing was the star. Animated stars in the background are made up from 8 animated elements. I google "nyan cat sprite" and found all the star frames &lt;a href="http://i1037.photobucket.com/albums/a453/DryBowser455/th_NyanCatSprite.png?t=1304659408"&gt;[like this]&lt;/a&gt;. The only way to animate it was pixel-perfect animation of each of 8 divs. It took me really lot of time:&lt;pre name="code" class="js"&gt;@-moz-keyframes star1 {&lt;br /&gt; 0% { top: 0; height: 5px;}&lt;br /&gt; 33.19% { top: 0; height: 5px; }&lt;br /&gt; 33.2% { height:10px; top:0; }&lt;br /&gt; 49.79% { height:10px; top:0; }&lt;br /&gt; 49.8% { height:10px; top:5px; }&lt;br /&gt; 66.39% {height:10px; top:5px; }&lt;br /&gt; 66.4% { height:5px; top:10px;}&lt;br /&gt; 82.99% { height:5px; top:10px;}&lt;br /&gt; 83% { height: 5px; top: 15px; }&lt;br /&gt; 99.99% { height: 5px; top: 15px; }&lt;br /&gt; 100% { top: 0; height: 5px; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@-moz-keyframes star2-3-6-7 {&lt;br /&gt; 0% { visibility: hidden; }&lt;br /&gt; 16.59% { visibility: hidden; }&lt;br /&gt; 16.6% { visibility: visible; }&lt;br /&gt; 33.19% { visibility: visible; }&lt;br /&gt; 33.2% { visibility: hidden; }&lt;br /&gt; 100% { visibility: hidden; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@-moz-keyframes star4 {&lt;br /&gt; 0% { left: 0; width: 5px; visibility: visible;}&lt;br /&gt; 33.19% { left: 0; width: 5px; }&lt;br /&gt; 33.2% { width:10px; left:0; }&lt;br /&gt; 49.79% { width:10px; left:0; }&lt;br /&gt; 49.8% { width:10px; left:5px; }&lt;br /&gt; 66.39% {width:10px; left:5px; }&lt;br /&gt; 66.4% { width:5px; left:10px;}&lt;br /&gt; 82.99% { width:5px; left:10px;}&lt;br /&gt; 83% { width: 5px; left: 15px; visibility:hidden;}&lt;br /&gt; 99.99% { width: 5px; left: 15px; visibility:hidden;}&lt;br /&gt; 100% { left: 0; width: 5px; visibility:hidden;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@-moz-keyframes star5 {&lt;br /&gt; 0% { left: 38px; width: 5px; visibility: visible;}&lt;br /&gt; 33.19% { left: 38px; width: 5px; }&lt;br /&gt; 33.2% { width:10px; left:33px; }&lt;br /&gt; 49.79% { width:10px; left:33px; }&lt;br /&gt; 49.8% { width:10px; left:28px; }&lt;br /&gt; 66.39% {width:10px; left:28px; }&lt;br /&gt; 66.4% { width:5px; left:28px;}&lt;br /&gt; 82.99% { width:5px; left:28px;}&lt;br /&gt; 83% { width: 5px; left: 15px; visibility:hidden;}&lt;br /&gt; 99.99% { width: 5px; left: 15px; visibility:hidden;}&lt;br /&gt; 100% { left: 0; width: 5px; visibility:hidden;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@-moz-keyframes star8 {&lt;br /&gt; 0% { top: 32px; height: 5px; visibility:visible;}&lt;br /&gt; 33.19% { top: 32px; height: 5px; }&lt;br /&gt; 33.2% { height:10px; top:28px; }&lt;br /&gt; 49.79% { height:10px; top:28px; }&lt;br /&gt; 49.8% { height:10px; top:23px; }&lt;br /&gt; 66.39% {height:10px; top:23px; }&lt;br /&gt; 66.4% { height:5px; top:18px;}&lt;br /&gt; 82.99% { height:5px; top:18px;}&lt;br /&gt; 83% { height: 5px; top: 15px; visibility:hidden;}&lt;br /&gt; 99.99% { height: 5px; top: 15px; visibility:hidden;}&lt;br /&gt; 100% { top: 0; height: 5px; visibility:hidden;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.star {&lt;br /&gt; position: absolute;&lt;br /&gt; width: 40px;&lt;br /&gt; height: 40px;&lt;br /&gt; z-index: 10;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.star div {&lt;br /&gt; width: 5px;&lt;br /&gt; height: 5px;&lt;br /&gt; background-color: #fff;&lt;br /&gt; position: absolute;&lt;br /&gt; -moz-animation: star1 0.4s linear 0s infinite;&lt;br /&gt; -webkit-animation: star1 0.4s linear 0s infinite;&lt;br /&gt;}&lt;/pre&gt;&lt;a href="https://developer.mozilla.org/en-US/demos/detail/css-nyan-cat"&gt;&lt;img src="http://images.virtualdesign.pl/images/375991308881152_screenshot_1.png.jpg" width="430" /&gt;&lt;/a&gt;&lt;br /&gt;Here is the final result of everything: &lt;a href="https://developer.mozilla.org/en-US/demos/detail/css-nyan-cat"&gt;CSS NYAN CAT&lt;/a&gt;, and &lt;a href="https://github.com/michalbe/css-nyan-cat"&gt;Github repo&lt;/a&gt;.&lt;b&gt; If you like it, don't forget to click "I like it" on Mozilla's page!&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-6921547831191072280?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/6921547831191072280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/06/few-words-about-my-css-nyan-cat.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6921547831191072280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6921547831191072280'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/06/few-words-about-my-css-nyan-cat.html' title='Few words about my CSS Nyan Cat'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2749/5854093539_551d141672_t.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-7598869406055153211</id><published>2011-06-09T06:23:00.000-07:00</published><updated>2011-06-09T08:07:42.187-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='workshops'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><title type='text'>The Flame Party Helsinki</title><content type='html'>&lt;img src="http://images.virtualdesign.pl/images/63859demoparty_the_flame_party_logo1.png" width="430"&gt;&lt;br /&gt;If you are planning to spend next weekend in Finland, you cannot omit &lt;a href="http://mozillalabs.com/demoparty/helsinki"&gt;Flame Party&lt;/a&gt; organized there by &lt;a href="http://mozillalabs.com/demoparty"&gt;Mozilla&lt;/a&gt;, &lt;a href="http://www.altparty.org/2011/"&gt;Alternative Party Crew&lt;/a&gt; and &lt;a href="http://dot.ayy.fi/index.php?s=dot&amp;p=9"&gt;DOT&lt;/a&gt;. It will be awesome weekend full of coding, BBQ, free drinks, Finish saunas and outstanding workshops including one lead by my - &lt;b&gt;"Dive into HTML5 Animation"&lt;/b&gt;:&lt;br /&gt;&lt;blockquote&gt;"During the workshop you will learn about different methods of  animation in JavaScript. We will compare the performance and ease of it's implementation in various browsers on different devices. Are we condemned to use DOM? What about new CSS techniques? Or maybe canvas is future of the web games?"&lt;/blockquote&gt;&lt;br /&gt;So what are you waiting for? &lt;a href="http://www.fläbät.fi/event/010c7910/"&gt;Register now&lt;/a&gt; and follow the party on &lt;a href="http://lanyrd.com/2011/the-flame-party-helsinki/"&gt;Lanyrd&lt;/a&gt; and &lt;a href="http://www.facebook.com/event.php?eid=208867699145074"&gt;Facebook&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-7598869406055153211?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/7598869406055153211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/06/flame-party-helsinki.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7598869406055153211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7598869406055153211'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/06/flame-party-helsinki.html' title='The Flame Party Helsinki'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-2513665403475344219</id><published>2011-06-05T07:54:00.000-07:00</published><updated>2011-06-05T11:30:41.325-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='mibbu'/><title type='text'>CSS Animation in Firefox</title><content type='html'>Mibbu now supports CSS Animations also in Firefox. The only version in which I have tested it is 5.0/Beta, but I think it should works also in Aurora. Feature detection problem &lt;a href="http://michalbe.blogspot.com/2011/05/css3-animations-in-mibbu.html"&gt;I describe last week &lt;/a&gt;wasn't the only unexpected behavior during implementing this (BTW, I want to thanks Anonymous guy who corrects my attempt - &lt;a href="http://michalbe.blogspot.com/p/contact-me.html"&gt;contact me&lt;/a&gt;, I have only your IP &amp; Country you were writing from:), and &lt;a href="http://paulirish.com/"&gt;Paul Irish&lt;/a&gt; for deeper explanation of the problem).&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/71715Zrzutekranu2011-06-05(godz.16.03.34).png" width="430"/&gt;&lt;br /&gt;Every animation I've created using Mibbu in Firefox animate only once. No matter if I put 'infinite' as a value of AnimationIterationCount. Using &lt;a href="http://www.w3.org/TR/css3-animations/#the-animation-shorthand-property-"&gt;MozAnimation shorthand property&lt;/a&gt; doesn't want to work. I rewrote everything couple of times in different ways without any result (sometimes it just stop working also on webkit:)). And then I figure out that setting 'none' as 'MozAnimationDelay' instead of 0 (&lt;a href="http://www.w3.org/TR/css3-animations/#the-animation-delay-property-"&gt;as in the spec!&lt;/a&gt;) solves everything. Nice try Mozilla, but it is again 1:0 for me:). I really love everything from Mozilla, Firefox is my main browser, each day I'm working with technologies created there (also in my full time job in GaduGadu), I'm excited in every news like &lt;a href="http://twitter.com/#!/marcoos/status/77372844971003905"&gt;THIS ONE&lt;/a&gt;, and I even ran &lt;a href="https://developer.mozilla.org/en/XUL"&gt;XUL&lt;/a&gt; workshop two weeks ago &lt;a href="http://falsyvalues.com/speakers.html#litman-budzynski"&gt;on FalsyValues conference&lt;/a&gt;. But sometimes I simply don't understand why they solve something in such a weird way.&lt;br /&gt;I also had to use MozAnimation attribute using brackets notation because Closure Compiler don't understand it and minimized it to the single letter. &lt;br /&gt;So, you can now &lt;a href="https://github.com/michalbe/mibbu"&gt;download Mibbu from my Github account&lt;/a&gt; and play with it.&lt;br /&gt;&lt;br /&gt;&lt;a name="update"&gt;UPDATE&lt;/a&gt;&lt;br /&gt;Ok, thanks to &lt;a href="http://blog.marcoos.com/"&gt;Marek Stepien's&lt;/a&gt; research done after my post we figured out that putting delay value without the unit ('0' instead of '0s') solves the problem. Probably, when we put single digit without units, Firefox thought that it is -animation-iteration-count (the only property without any units). Marek creates bug report for this &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=662171"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-2513665403475344219?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/2513665403475344219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/06/css-animation-in-firefox.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/2513665403475344219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/2513665403475344219'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/06/css-animation-in-firefox.html' title='CSS Animation in Firefox'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4459063645831278242</id><published>2011-05-30T16:03:00.000-07:00</published><updated>2011-05-30T16:03:44.026-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='conference'/><category scheme='http://www.blogger.com/atom/ns#' term='ongamestart'/><title type='text'>onGameStart tickets</title><content type='html'>It is now possible to register to &lt;a href="http://ongamestart.com "&gt;onGameStart&lt;/a&gt; - first HTML5 game conference. Don't wait for anything, just go to &lt;a href="http://ongamestart.com "&gt;http://ongamestart.com&lt;/a&gt; and do what you have to do:).&lt;br/&gt;&lt;br/&gt;&lt;img width="430" src="http://images.virtualdesign.pl/images/69782Zrzutekranu2011-05-31(godz.00.31.12).png" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4459063645831278242?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4459063645831278242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/05/ongamestart-tickets.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4459063645831278242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4459063645831278242'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/05/ongamestart-tickets.html' title='onGameStart tickets'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-3560509714856575729</id><published>2011-05-29T15:07:00.000-07:00</published><updated>2011-05-29T15:20:09.045-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='frameworks'/><category scheme='http://www.blogger.com/atom/ns#' term='css3'/><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='ongamestart'/><category scheme='http://www.blogger.com/atom/ns#' term='mibbu'/><title type='text'>CSS3 animations in Mibbu</title><content type='html'>Last week &lt;a href="http://twitter.com/#!/michalbe/status/72435732635070464"&gt;I implement CSS Animations&lt;/a&gt; in my gamedev micro framework, &lt;a href="http://mibbu.eu/"&gt;Mibbu&lt;/a&gt;.&lt;br /&gt;It is possible now to animate sprites in three different ways - cropping parts of the sprite with .drawImage() in 'canvas mode', manipulating 'top' &amp; 'left' attributes of absolute position of the image [&lt;a href="http://michalbe.blogspot.com/2010/10/four-methods-of-javascript-animation.html"&gt;both described in here&lt;/a&gt;] and CSS Animation in DOM mode.&lt;br /&gt;For now Mibbu supports CSS animations only in webkit based browsers. I know that beta version of Firefox supports it as well, but I didn't find easy way to detect it. In webkit we can just check what is the initial value of given attribute (use whatever DOM element you want), like this:&lt;br /&gt;&lt;pre name="code" class="js"&gt;if (typeof document.body.style.webkitAnimation !== "undefined") {&lt;br /&gt;//all your animation are belong to us&lt;br /&gt;} else {&lt;br /&gt;//no css animations:(&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Unfortunately it don't work in Aurora, mozAnimation always return 'undefined'. Is there any way to easy detect it?&lt;br /&gt;&lt;br /&gt;The main point in creating css animations is preparing proper keyframes in a css classes and connecting it to the DOM elements with description parameters like duration or number of iterations. CSS engine will be responsible for sprite animation so draw() function of each sprite object should be empty. The keyframes are generated during constructing the object and append to the document - one class in one script element, it will be easier to edit them when the parameters of the animation will change during the gameplay. I also wrote a little function to convert speed of an animation (from Canvas &amp; DOM mode) to the CSS Animation Duration parameter.&lt;br /&gt;&lt;pre name="code" class="js"&gt;var calculateSpeed = function(speed, frames) {&lt;br /&gt;    return (~~((1 / (60 / speed)) * 100) / 100) * (frames+1);&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;constructAnimationClass = function(){&lt;br /&gt; var animClass = "@-webkit-keyframes 's" + t.id + "' {\n",&lt;br /&gt;        step = 100 / (t.fs + 1),&lt;br /&gt;        str = '% { -webkit-transform: translate(';&lt;br /&gt;&lt;br /&gt;    for (var q = 0; q &lt; t.fs+1; q++) {&lt;br /&gt;        animClass += ~~((step * q) * 100) / 100 + str + t.animation * t.width*-1 + 'px,' + q * t.height * -1 + 'px); }\n';&lt;br /&gt;        animClass += ~~((step * (q + 1) - 0.01) * 100) / 100 + str + t.animation * t.width * -1 + 'px,' + q * t.height * -1 + 'px); }\n';&lt;br /&gt;    }&lt;br /&gt;                &lt;br /&gt;    return animClass += '100'+ str +t.animation*t.width+'px, 0px); }\n}';&lt;br /&gt;                &lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;//append created class to the document&lt;br /&gt;t.animStyle = document.createElement('style');&lt;br /&gt;t.animStyle.innerHTML = constructAnimationClass();&lt;br /&gt;document.body.appendChild(t.animStyle);&lt;br /&gt;&lt;/pre&gt;Above code creates class like this:&lt;a href="http://images.virtualdesign.pl/images/94494Zrzutekranu2011-05-29%28godz.23.30.29%29.png"&gt;&lt;img src="http://images.virtualdesign.pl/images/94494Zrzutekranu2011-05-29%28godz.23.30.29%29.png" width="490"/&gt;&lt;/a&gt;And every sprite needs to implement description of the animation (name is created by concatenating 's' and internal id of the sprite:&lt;pre name="code" class="js"&gt;t.style.webkitAnimation = "'s"+t.id+"' "+calculateSpeed(t.speed, t.fs)+"s linear 0 infinite";&lt;br /&gt;&lt;/pre&gt;Main problem I had with implementing this was pausing the game - even if main loop stops, CSS engine still animates the keyframes. So I just set '0' for the -webkit-animaition-duration parameter:&lt;pre name="code" class="js"&gt;'off': function(){&lt;br /&gt;    MB_Stop();&lt;br /&gt;    if (MB_usingCSSAnimations){&lt;br /&gt;        var i = MB_elements.length;&lt;br /&gt;        for (;i--;){&lt;br /&gt;            if (MB_elements[i].image)&lt;br /&gt;                MB_elements[i].image.style.webkitAnimationDuration = 0;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;It sucks but it works. Anyone know better solution?Next step is to provide support of webkitAnimationIterations for iteration's callbacks (now it is calculated using JavaScript, not with the events, but contrary to what I thought webkit has already supported DOM events for animation [thanks &lt;a href="http://twitter.com/#!/askoth"&gt;Askoth&lt;/a&gt;]). If you want help feel free and contribute: &lt;a href="https://github.com/michalbe/mibbu"&gt;Mibbu on github&lt;/a&gt;. There are also &lt;a href="https://github.com/michalbe/mibbu/issues?sort=created&amp;direction=desc&amp;_pjax=true&amp;state=open"&gt;some issues&lt;/a&gt; I found creating new features and I have no time to fix it now. If you use &lt;a href="http://mibbu.eu/"&gt;Mibbu&lt;/a&gt; and have some ideas or found any bugs, write me about it or fork &amp; pull request on &lt;a href="https://github.com/michalbe/mibbu"&gt;Github&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;BTW, Github will be one of the sponsors of &lt;a href="http://ongamestart.com/"&gt;onGameStart, HTML5 Game Conference&lt;/a&gt;. We will open registration on Monday evening Central European time, so check &lt;a href="http://ongamestart.com/"&gt;the conference page&lt;/a&gt; and don't miss it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-3560509714856575729?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/3560509714856575729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/05/css3-animations-in-mibbu.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3560509714856575729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3560509714856575729'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/05/css3-animations-in-mibbu.html' title='CSS3 animations in Mibbu'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-5683304703850561628</id><published>2011-05-04T17:46:00.000-07:00</published><updated>2011-05-04T18:04:09.010-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='frameworks'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='mibbu'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Mibbu - javascript html5 game framework</title><content type='html'>&lt;img src="http://images.virtualdesign.pl/images/69143mibbu.jpg" style="float:right;margin-left:12px;width:200px" /&gt;I have just published initial release of &lt;a href="http://mibbu.eu/"&gt;Mibbu&lt;/a&gt; - my javascript microframework for fast game prototyping. To be honest - it is just set of functions and patterns I use always when I write my games. It is more a sandbox, starting place with basic tools, than a real framework (that's why I called it 'microframework'). It provides sprite animations, basic operations like movement or collisions, scrolling backgrounds and drawing on both - canvas or DOM. It uses DOM only when it is not possible to use Canvas (like in older IEs), but you can force it to do so with one single function (&lt;b&gt;&lt;a href="http://mibbu.eu/#canvasOff"&gt;canvasOff()&lt;/a&gt;&lt;/b&gt;) - then it will be drawn with divs &amp; imgs. It is the same mechanics I have used in &lt;a href="http://openodyssey.mibbu.eu/"&gt;OpenOdyssey&lt;/a&gt; or &lt;a href="https://developer.mozilla.org/pl/demos/detail/janpu"&gt;Janpu&lt;/a&gt;. I will try to write something more about using &lt;a href="https://github.com/michalbe/mibbu"&gt;Mibbu&lt;/a&gt; later this week.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-5683304703850561628?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/5683304703850561628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/05/mibbu-javascript-microframework-for.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5683304703850561628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5683304703850561628'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/05/mibbu-javascript-microframework-for.html' title='Mibbu - javascript html5 game framework'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-5600770428854688429</id><published>2011-04-30T03:15:00.000-07:00</published><updated>2011-04-30T12:07:12.454-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='games'/><category scheme='http://www.blogger.com/atom/ns#' term='ongamestart'/><category scheme='http://www.blogger.com/atom/ns#' term='gamedevelopment'/><title type='text'>First HTML5 Game Conference ever - onGameStart</title><content type='html'>As probably most of you already know - I'm organizing first HTML5 game conference ever. It will take place in my hometown - &lt;a href="http://en.wikipedia.org/wiki/Warsaw"&gt;Warsaw&lt;/a&gt; at 22nd &amp; 23rd of September 2011. I've done my best with selection of the speakers - so far it is the only chance to meet and talk with the best Open Web Game developers. Let me introduce some of them:&lt;br /&gt;&lt;b&gt;&lt;a href="http://www.everyday3d.com/"&gt;Bartek Drozd&lt;/a&gt;&lt;/b&gt; - creator of &lt;a href="https://github.com/drojdjou/J3D"&gt;J3D&lt;/a&gt; - WebGL Library with Unity3d object/scene exporter.&lt;br /&gt;&lt;b&gt;&lt;a href="http://www.rawkes.com/"&gt;Rob Hawkes&lt;/a&gt;&lt;/b&gt; - author of &lt;a href="http://www.amazon.co.uk/gp/product/1430232919/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;tag=rawkes-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=1430232919"&gt;"Foundation HTML5 Canvas"&lt;/a&gt; book&lt;br /&gt;&lt;b&gt;&lt;a href="http://agent8ball.com/"&gt;Robby Ingebretsen&lt;/a&gt;&lt;/b&gt; - creator of Agent008Ball&lt;br /&gt;&lt;b&gt;&lt;a href="http://blog.tojicode.com/"&gt;Brandon Jones&lt;/a&gt;&lt;/b&gt; - author of &lt;a href="http://code.google.com/p/glmatrix/"&gt;glMatrix&lt;/a&gt; library and a lot of awesome webGL demos (like &lt;a href="http://media.tojicode.com/q3bsp/"&gt;Quake III&lt;/a&gt;)&lt;br /&gt;&lt;b&gt;&lt;a href="http://www.martinkool.com/"&gt;Martin Kool&lt;/a&gt;&lt;/b&gt; - creator of multiplayer, online versions of old good Sierra games - &lt;a href="http://sarien.net"&gt;Sarien&lt;/a&gt;&lt;br /&gt;&lt;b&gt;&lt;a href="http://sethladd.com/"&gt;Seth Ladd&lt;/a&gt;&lt;/b&gt; - Google developer advocate (he will speak on &lt;a href="http://www.google.com/events/io/2011/sessions_schedule.html"&gt;Google IO&lt;/a&gt; in two weeks - don't miss it!)&lt;br /&gt;&lt;b&gt;&lt;a href="http://nekapuzer.at/"&gt;Simon Oberhammer&lt;/a&gt;&lt;/b&gt; - creator of pyGame port for Javascript - GameJS&lt;br /&gt;&lt;b&gt;&lt;a href="http://www.freeciv.net/"&gt;Andreas Røsdal&lt;/a&gt;&lt;/b&gt; - originator of biggest strategy game made in open web technologies based on Sid Mayer's Civilization - Freeciv.net&lt;br /&gt;&lt;b&gt;&lt;a href="http://www.phoboslab.org/"&gt;Dominic Szablewski&lt;/a&gt;&lt;/b&gt; - creator of ImpactJS - most complex and so far the best Javascript game engine.&lt;br /&gt;&lt;br /&gt;For more information about the conference check our &lt;a href="http://ongamestart.com/"&gt;site&lt;/a&gt;, &lt;a href="http://lanyrd.com/2011/ongamestart/"&gt;lanyrd&lt;/a&gt;, &lt;a href="http://twitter.com/#!/onGameStart"&gt;twitter&lt;/a&gt; and &lt;a href="http://www.facebook.com/onGameStart"&gt;facebook&lt;/a&gt;. And don't forget to preregister (it is possible on the site).&lt;br /&gt;&lt;a href="http://ongamestart.com"&gt;&lt;img src="http://img825.imageshack.us/img825/3203/ogse.jpg" width="430" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-5600770428854688429?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/5600770428854688429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/04/first-html5-game-conference-ever.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5600770428854688429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5600770428854688429'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/04/first-html5-game-conference-ever.html' title='First HTML5 Game Conference ever - onGameStart'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4523115796256919812</id><published>2011-04-10T02:47:00.000-07:00</published><updated>2011-04-23T00:54:21.299-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='workshops'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='games'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='gadugadu'/><title type='text'>GG Workshop</title><content type='html'>Yesterday I ran Javascript workshop about creating Apps &amp; Games in Social Networks. Fourteen great developers in eight hours tried to create multiplayer checkers (draughts? what's the difference?) game and adapt it to two social network APIs (&lt;a href="htp://facebook.com"&gt;Facebook&lt;/a&gt; &amp; &lt;a href="http://gg.pl"&gt;GG.pl&lt;/a&gt;). I published source code of the final result &lt;a href="https://github.com/michalbe/szkolenieGG"&gt;on my Github&lt;/a&gt;, just as &lt;a href="https://github.com/narfdotpl/gg-checkers"&gt;Maciej Konieczny&lt;/a&gt;, one of the participants. Here are also my slides and couple of photos:&lt;br /&gt;&lt;br /&gt;&lt;div style="width:425px" id="__ss_7576298"&gt;&lt;strong style="display:block;margin:12px 0 4px"&gt;&lt;a href="http://www.slideshare.net/michalbu/gg-workshop-games-apps-in-javascript" title="GG WORKSHOP GAMES &amp;amp; APPS IN JAVASCRIPT"&gt;GG WORKSHOP GAMES &amp;amp; APPS IN JAVASCRIPT&lt;/a&gt;&lt;/strong&gt; &lt;iframe src="http://www.slideshare.net/slideshow/embed_code/7576298" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"&gt;&lt;/iframe&gt; &lt;div style="padding:5px 0 12px"&gt;View more &lt;a href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/michalbu"&gt;michalbu&lt;/a&gt; &lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://img696.imageshack.us/g/obraz013f.jpg/"&gt;&lt;br /&gt;&lt;img src="http://img684.imageshack.us/img684/3772/obraz013r.png" /&gt;&lt;br /&gt;&lt;img src="http://img808.imageshack.us/img808/10/obraz021.png" /&gt;&lt;br /&gt;&lt;img src="http://img695.imageshack.us/img695/4387/obraz029g.png" /&gt;&lt;br /&gt;&lt;img src="http://img852.imageshack.us/img852/1110/obraz036.png" /&gt;&lt;br /&gt;&lt;img src="http://img811.imageshack.us/img811/6385/obraz037.png" /&gt;&lt;/a&gt;&lt;br /&gt;I would like to thanks everyone for the presence and I hope we will meet on frontend meetings in near future (like those organized by &lt;a href="http://googlepolska.blogspot.com/2011/04/deweloperzy-spotkajmy-sie.html"&gt;Google Poland&lt;/a&gt;). If you will find some free time feel free to rate my workshop &lt;a href="http://speakerrate.com/michalbe"&gt; on SpeakerRate&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4523115796256919812?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4523115796256919812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/04/gg-workshop.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4523115796256919812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4523115796256919812'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/04/gg-workshop.html' title='GG Workshop'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4001594580848575394</id><published>2011-03-29T03:33:00.000-07:00</published><updated>2011-03-29T04:08:21.185-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='other'/><title type='text'>Sun^26</title><content type='html'>&lt;img src="http://img191.imageshack.us/img191/1296/oursun.gif" style="float:left;width:150px;margin-right:10px;"/&gt;That post has nothing in common with programming or even computers but I was so excited when I discover things I want to write about that 140 chars of twitter wasn't enough for me. &lt;br/&gt;&lt;br /&gt;The Sun is a star in the center of our Solar System Anyone knows that. But have you ever think about number '&lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;' in Sun statistics? &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Apparent magnitude of the Sun is -&lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;,8&lt;/li&gt;&lt;li&gt;Mean distance from Milky Way &lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;,000ly&lt;/li&gt;&lt;li&gt;Galactic period 2&lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;.000.000 years&lt;/li&gt;&lt;li&gt;Radiant flux 3,827×10^&lt;span style="font-weight:bold;"&gt;26&lt;/span&gt; W&lt;/li&gt;&lt;li&gt;Unicode of Sun symbol - &lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;09&lt;/li&gt;&lt;li&gt;Distance from Milky Way Equator - &lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;ly&lt;/li&gt;&lt;li&gt;Speed &lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;0 km/s&lt;li&gt;&lt;li&gt;Conversion rate of mass-energy 4.&lt;span style="font-weight:bold;"&gt;26&lt;/span&gt; million metric tons per second&lt;/li&gt;&lt;li&gt;Mean mass loss in energy &lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;,732MeV&lt;/li&gt;&lt;li&gt;Total mass loss 6,5x10^&lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;&lt;/li&gt;&lt;li&gt;STEREO observation mission starts at &lt;span style="font-weight:bold;"&gt;26&lt;/span&gt;th of October &lt;span style="font-weight:bold;"&gt;2&lt;/span&gt;00&lt;span style="font-weight:bold;"&gt;6&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Coincidence? Don't think so! :)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;from &lt;a href="http://pl.wikipedia.org/wiki/S%C5%82o%C5%84ce"&gt;Polish&lt;/a&gt; &amp; &lt;a href="http://en.wikipedia.org/wiki/Sun"&gt;English&lt;/a&gt; Wikipedia.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4001594580848575394?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4001594580848575394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/03/sun26.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4001594580848575394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4001594580848575394'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/03/sun26.html' title='Sun^26'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-1276032602632986949</id><published>2011-03-19T10:12:00.000-07:00</published><updated>2011-03-19T11:31:00.213-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><title type='text'>meet.js in Warsaw</title><content type='html'>I have just returned from Warsaw edition of &lt;a href="http://jsnews.pl/"&gt;meet.js&lt;/a&gt;, polish javascript meeting organized by &lt;a href="http://ferrante.pl/"&gt;Damian Wielgosik&lt;/a&gt; and &lt;a href="http://czerski.info/"&gt;Paweł Czerski&lt;/a&gt;, organizers of &lt;a href="http://front-trends.com/"&gt;FrontTrends&lt;/a&gt; and &lt;a href="http://falsyvalues.com/"&gt;Falsy Values&lt;/a&gt;. During the meeting we ware able to watch four Javascript tech-talks.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/79366roberttomaszewski.png" /&gt;First was Robert Tomaszewski from &lt;a href="http://www.hypermediaisobar.pl/"&gt;Hypermedia Isobar&lt;/a&gt; with his presentation about different context of calling Js structures. He started with a little of JS history, then explained basics of using 'this' depending on placement of the objects and different approaches of using 'this' in DOM events.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/5248marekstepien.png" width="430"/&gt; Next was &lt;a href="http://blog.marcoos.com/"&gt;Marek Stepień&lt;/a&gt; - lead of &lt;a href="http://www.aviary.pl/"&gt;Aviary.pl&lt;/a&gt;, team of programmers and translators localizing open source software for Polish users. He started with review of past JS objects, its restrictions and methods of its elimination. Then he presented new methods of creating objects in Js 1.8.5 like defineProperty() etc. &lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/76543tomasztunik.png" widh="430"/&gt;After the break there were a little contest - I won weekend stay in &lt;a href="http://en.wikipedia.org/wiki/Karpacz"&gt;Karpacz&lt;/a&gt; for my implementation of adding function (Thanks!:) ). Just after that &lt;a href="http://twitter.com/#!/I_am_thomas"&gt;Tomasz Tunik&lt;/a&gt; talked about his &lt;a href="http://provoke.it/einie/"&gt;Einie framework&lt;/a&gt;. He showed a lot of cool examples (like mouse tracking and interactions with canvas objects, or &lt;a href="http://scorch.duostack.net/"&gt;Pew! Pew! Towers&lt;/a&gt;, game created in 48h by Thomas and &lt;a href="http://twitter.com/#!/ard"&gt;Szymon Pilkowski&lt;/a&gt; on &lt;a href="http://html5gamejam.org/"&gt;HTML5gameJam in Paris&lt;/a&gt;. All of that examples are published on &lt;a href="http://provoke.it/einie/"&gt;Einie's site&lt;/a&gt; so don't hesitate to check it.&lt;br /&gt;&lt;br /&gt;Last presentation was made by me. I was talking about pseudorandom numbers and &lt;a href="http://en.wikipedia.org/wiki/Steganography"&gt;Steganography&lt;/a&gt;. I won't describe my talk, maybe someone else will, I think in couple of days I will publish it as a blog post or maybe little JS library. &lt;br /&gt;I want to thanks the organizers one more time, and I hope we will meet on the next meet.js (or at least on Falsy Values:) ).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-1276032602632986949?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/1276032602632986949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/03/meetjs-in-warsaw.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1276032602632986949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1276032602632986949'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/03/meetjs-in-warsaw.html' title='meet.js in Warsaw'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-3485191368091356825</id><published>2011-03-03T13:42:00.000-08:00</published><updated>2011-03-03T13:42:30.309-08:00</updated><title type='text'>Birthday</title><content type='html'>My blog is one year old today.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/792461st-birthday-cake.jpg" width=430 /&gt;I will try to write some summary of that period later this week or at the beginning of the next one. For sure one of the best things I wrote about was my &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;HTML5 Canvas Game Tutorial&lt;/a&gt;, one of the most popular in all over the web, but there were also other posts I would like to remind.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-3485191368091356825?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/3485191368091356825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/03/birthday.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3485191368091356825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3485191368091356825'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/03/birthday.html' title='Birthday'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-8500066220203866749</id><published>2011-02-27T04:21:00.000-08:00</published><updated>2011-02-27T10:45:24.075-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css3'/><category scheme='http://www.blogger.com/atom/ns#' term='gamedev'/><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><title type='text'>CSS3 sprite animation, issues in Safari</title><content type='html'>Together with CSS3 standard we get &lt;a href="http://www.w3.org/TR/css3-animations/"&gt;awesome tool for creating hardware accelerated css-only animated sprites&lt;/a&gt;. For now it is implemented only in webkit based browsers like Safari, Chrome or most of the mobile browsers. &lt;a href="http://paulbakaus.com/2010/12/07/finally-sprite-animations-implemented-via-css3-animations/"&gt;Paul Bakaus&lt;/a&gt; described it on his blog months ago, &lt;a href="http://paulbakaus.com/2010/12/15/sprite-animations-on-css-transitions-revisited/"&gt;with additional approaches and performance optimization methods&lt;/a&gt;. Also &lt;a href="http://twitter.com/m4r00p"&gt;Marek Pawlowski&lt;/a&gt; said a lot about this &lt;a href="http://devmeetings.pl/trainings/programowanie-gier-w-javascript"&gt;on his DevMeeting gamedev workshop&lt;/a&gt;. Working on my new mobile game, I've tested everything I could find all over web. And some of the examples (&lt;a href="http://paulbakaus.com/lab/css/animated_sprite_css3_revisited/"&gt;like that Paul's created with Doug Neiner&lt;/a&gt;) did not works on Safari and some mobiles (like Samsung's Dolfin on my bada Wave). I spend couple of annoying hours to figure out what happens, analyzing different use cases, different examples and documentation pages. But solution was simple as hell: &lt;blockquote&gt;&lt;b&gt;Safari and some of mobile browsers cannot animate any element with CSS3 animation if there is no '0%' and '100%' step.&lt;/b&gt;&lt;/blockquote&gt;That's why example from Paul's blog didn't want to work when I test them:&lt;pre name="code" class="js"&gt;@-webkit-keyframes 'animationName' {&lt;br /&gt;  0% { background-position: 0px 0px; }&lt;br /&gt;  12.5% { background-position: -128px 0px; }&lt;br /&gt;  25% { background-position: -256px 0px; }&lt;br /&gt;  37.5% { background-position: -384px 0px; }  &lt;br /&gt;  50% { background-position: -512px 0px; }&lt;br /&gt;  62.5% { background-position: -640px 0px; }&lt;br /&gt;  75% { background-position: -768px 0px; }&lt;br /&gt;  87.5% { background-position: -896px 0px; }&lt;br /&gt;}&lt;/pre&gt;Adding the last frame, with the same parameters as the first one, fixes the problem:&lt;pre name="code" class="js"&gt;@-webkit-keyframes 'animationName' {&lt;br /&gt;  0% { background-position: 0px 0px; }&lt;br /&gt;  12.5% { background-position: -128px 0px; }&lt;br /&gt;  25% { background-position: -256px 0px; }&lt;br /&gt;  37.5% { background-position: -384px 0px; }  &lt;br /&gt;  50% { background-position: -512px 0px; }&lt;br /&gt;  62.5% { background-position: -640px 0px; }&lt;br /&gt;  75% { background-position: -768px 0px; }&lt;br /&gt;  87.5% { background-position: -896px 0px; }&lt;br /&gt;  100% { background-position: 0px 0px; }&lt;br /&gt;}&lt;/pre&gt;Of course I didn't want to show that Paul and other guys was wrong - for sure all of them has bigger experience and knowledge than me. And their solutions will eventually work when browsers will implement the standards (what was the point I supposed) - but I was looking for something what will work here and now.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/50726a.png" style="width:430px;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-8500066220203866749?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/8500066220203866749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/02/css3-sprite-animation-safari-issue.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/8500066220203866749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/8500066220203866749'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/02/css3-sprite-animation-safari-issue.html' title='CSS3 sprite animation, issues in Safari'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-3958924498152419536</id><published>2011-02-23T16:53:00.000-08:00</published><updated>2011-04-14T01:22:34.460-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='random number'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><title type='text'>Javascript random numbers with custom seed - part 2</title><content type='html'>&lt;img src="http://img715.imageshack.us/img715/1192/89994001.jpg" style="width:120px;float:right;margin-left:10px" /&gt;Generator created in previous example was able only to create integer numbers from zero to the given maximum (2^50) using provided seed. But in most cases we need random numbers from some range, so lets modify previous example and add 'min' and 'max' arguments to the .next() method. Also, to make it more like the native Math.rand(), let's make it generating floats from 0 to 1.&lt;pre name="code" class="js"&gt;var CustomRandom = function(nseed) {    &lt;br /&gt;  &lt;br /&gt;  var seed,    &lt;br /&gt;    constant = Math.pow(2, 13)+1,    &lt;br /&gt;    prime = 1987,    &lt;br /&gt;//any prime number, needed for calculations, 1987 is my favorite:)  &lt;br /&gt;    maximum = 1000;    &lt;br /&gt;//maximum number needed for calculation the float precision of the numbers (10^n where n is number of digits after dot)  &lt;br /&gt;    if (nseed) {    &lt;br /&gt;      seed = nseed;    &lt;br /&gt;    }    &lt;br /&gt;    &lt;br /&gt;    if (seed == null) {    &lt;br /&gt;//before you will correct me in this comparison, read Andrea Giammarchi's text about coercion http://goo.gl/N4jCB  &lt;br /&gt;      &lt;br /&gt;      seed = (new Date()).getTime();   &lt;br /&gt;//if there is no seed, use timestamp     &lt;br /&gt;    }     &lt;br /&gt;    &lt;br /&gt;    return {    &lt;br /&gt;      next : function(min, max) {    &lt;br /&gt;        seed *= constant;    &lt;br /&gt;        seed += prime;    &lt;br /&gt;           &lt;br /&gt;      &lt;br /&gt;        return min &amp;&amp; max ? min+seed%maximum/maximum*(max-min) : seed%maximum/maximum;  &lt;br /&gt;// if 'min' and 'max' are not provided, return random number between 0 &amp; 1  &lt;br /&gt;      }    &lt;br /&gt;    }    &lt;br /&gt;}  &lt;/pre&gt;Now its easy to use it in such a way:&lt;pre name="code" class="js"&gt;var rng = CustomRandom(23);&lt;br /&gt;//use '23' as a seed&lt;br /&gt;    rng.next(); // 0.426&lt;br /&gt;    rng.next(); // 0.205&lt;br /&gt;&lt;/pre&gt;In the next part I will show some GameDev related examples of using Random Number Generators with custom seeds.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://michalbe.blogspot.com/2011/02/javascript-random-numbers-with-custom.html"&gt;Check 1st part of the "Javascript random numbers with custom seed" tutorial&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-3958924498152419536?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/3958924498152419536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/02/javascript-random-numbers-with-custom_23.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3958924498152419536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3958924498152419536'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/02/javascript-random-numbers-with-custom_23.html' title='Javascript random numbers with custom seed - part 2'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-909435143995829449</id><published>2011-02-17T15:42:00.000-08:00</published><updated>2011-02-24T02:15:17.172-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='random number'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><title type='text'>Javascript random numbers with custom seed - part 1</title><content type='html'>&lt;img src="http://images.virtualdesign.pl/images/4712201_dice_color.jpg" width="180" style="margin-right:10px;float:left;" /&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;br /&gt;Any random number generator generates sequences of numbers using some initial seed. The same seed always gives the same sequence. Most popular initialization method is to provide actual timestamp as seed - it changes every second so probability of receiving same sequences is very low. &lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/81894images.jpg" style="float:right;margin-left:10px;width:100px;" /&gt;Generating pseudorandom sequences of numbers has wide variety of uses, ranging from creating random maps for games (with well constructed map generator all the game should remember is just the initial seed, not the array with list of map elements), to &lt;a href="http://en.wikipedia.org/wiki/Steganography"&gt;steganography&lt;/a&gt;, where you code &amp; decode message on the sample image using the same seed (it is impossible to decode the information from the image without knowing exact number used as seed during coding it). I will create some examples in the next part of the series. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;First attempt&lt;/b&gt;&lt;br /&gt;Unfortunately, it is impossible to provide custom seed to the Javascript &lt;i&gt;Math.random()&lt;/i&gt;. It always uses timesamp for initialization. So let us create our own generator with everything we need.&lt;pre name="code" class="js"&gt;var CustomRandom = function(nseed) {&lt;br /&gt;&lt;br /&gt;    var seed,&lt;br /&gt;        constant = Math.pow(2, 13)+1,&lt;br /&gt;        prime = 37,&lt;br /&gt;        maximum = Math.pow(2, 50);&lt;br /&gt; &lt;br /&gt;    if (nseed) {&lt;br /&gt;        seed = nseed;&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    if (seed == null) {&lt;br /&gt;//if there is no seed, use timestamp&lt;br /&gt;        seed = (new Date()).getTime();&lt;br /&gt;    } &lt;br /&gt; &lt;br /&gt;    return {&lt;br /&gt;        next : function() {&lt;br /&gt;            seed *= constant;&lt;br /&gt;            seed += prime;&lt;br /&gt;            seed %= maximum;&lt;br /&gt;            &lt;br /&gt;            return seed;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;And now:&lt;pre name="code" class="js"&gt;var rng = CustomRandom(23);&lt;br /&gt;//use '23' as a seed&lt;br /&gt;    rng.next(); //188476&lt;br /&gt;    rng.next(); //1544183905&lt;br /&gt;    rng.next(); //12651498733702&lt;/pre&gt;In the next parts I will extend that CustomRandom() generator with limits (min and max value) and implement some real-life use cases.&lt;br /&gt;&lt;br /&gt;Check 2nd part of the tutorial: &lt;a href="http://michalbe.blogspot.com/2011/02/javascript-random-numbers-with-custom_23.html"&gt;Javascript random numbers with custom seed&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-909435143995829449?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/909435143995829449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/02/javascript-random-numbers-with-custom.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/909435143995829449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/909435143995829449'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/02/javascript-random-numbers-with-custom.html' title='Javascript random numbers with custom seed - part 1'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-9144291009293294522</id><published>2011-01-26T04:46:00.000-08:00</published><updated>2011-01-26T04:51:57.995-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Most useless skills ever aka how to implement sqrt() in javascript.</title><content type='html'>Couple of day ago, &lt;a href="http://www.twitter.com/phoboslab"&gt;Dominic Szablewski&lt;/a&gt;, author of &lt;a href="http://impactjs.com"&gt;Impact Engine&lt;/a&gt; tweets about interesting job interview:&lt;br /&gt;&lt;a href="http://images.virtualdesign.pl/images/95765szabla.png target="_blank"&gt;&lt;img src="http://images.virtualdesign.pl/images/95765szabla.png" width="430" /&gt;&lt;/a&gt;&lt;br /&gt;Seriously, WTF? Why Javascript developer, even working for such a big company as Facebook, needs to know how to re-implement build-in language elements? Knowing everything about everything was bane of elementary education - we have all been trained (at least here, in Eastern Europe), that when we need to know something we shouldn't use 'outside' sources such as books then and Internet now. Why? Personally, I didn't know any developer who didn't sometimes read the documentation, especially if it takes less than 3s if you know what you are looking for.&lt;br /&gt;In case that 'implementing sqrt()' task will ever occurs again, here are two of my JS implementations:) :&lt;br /&gt;&lt;pre name="code" class="js"&gt;//in this way calculators implements square roots:&lt;br /&gt;var ownSqrt = function(number) {&lt;br /&gt;    return Math.exp(Math.log(number)/2);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;But if it is forbidden to use Javascript Math object constants at all, the best way is to use approximation like this:&lt;pre name="code" class="js"&gt;var ownSqrt2 = function(number) {&lt;br /&gt;    var x = number;&lt;br /&gt;    while (Math.abs(x*x-number) &gt; 0.001) x = (x*x+number)/(2*x);&lt;br /&gt;    return x;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;There are a lot of different algorithms on &lt;a href="http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#"&gt;Wiki&lt;/a&gt;, and their implementations &lt;a href="http://codesearch.google.com/codesearch?hl=pl&amp;lr=&amp;q=%22square+root+of+a+number%22"&gt;all over the Web&lt;/a&gt;.&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#"&gt;&lt;img src="http://images.virtualdesign.pl/images/66046wiki.png" width="430" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-9144291009293294522?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/9144291009293294522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/01/most-useless-skills-ever-aka-how-to.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/9144291009293294522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/9144291009293294522'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/01/most-useless-skills-ever-aka-how-to.html' title='Most useless skills ever aka how to implement sqrt() in javascript.'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-941557798723833032</id><published>2011-01-14T11:06:00.000-08:00</published><updated>2011-01-14T12:03:38.609-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='frameworks'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='mibbu'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><title type='text'>Mozilla Game On 2010</title><content type='html'>During last Thursday it was possible to send your entry to the &lt;a href="https://gaming.mozillalabs.com/"&gt;Mozilla GameOn 2010&lt;/a&gt; Competition. There were more than 160 games submitted, but some of them was disqualified because of &lt;img src="http://images.virtualdesign.pl/images/33730mgo.png" style="float:right;width:200px;margin-left:5px;"/&gt;using 'non open' technologies like flash or Unity. Finally, there are &lt;a href="https://gaming.mozillalabs.com/games/"&gt;124 chosen titles in the gallery&lt;/a&gt;. Checking almost every game I found couple of technologies, libraries, plugins, frameworks or engines I've never heard of before, or just forgot about. Some of them are worth describing in here. First of all I totally forgot about &lt;a href="http://html5boilerplate.com/"&gt;HTML5 Boilerplate&lt;/a&gt;, an "&lt;i&gt;HTML/CSS/JS template for a fast, robust and future-proof site&lt;/i&gt;", used in &lt;a href="http://www.machinesong.com/projects/snake/"&gt;Snake game&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/25/snake"&gt;[MGO2010]&lt;/a&gt;. Another technically interesting entry was &lt;a href="http://starinfidel.co.cc/obelisk/"&gt;Black Obelisk&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/27/black-obelisk"&gt;[MGO2010]&lt;/a&gt;, written completely in &lt;a href="http://haxe.org"&gt;haXe&lt;/a&gt;, opensource programming language with ability to compile to Javascript, Flash, NekoVM bytecode, PHP, C++ and C# or Java in the near future. &lt;img src="http://images.virtualdesign.pl/images/57213mgo.png" style="float:left;margin-right:5px;" /&gt;Couple of games was written in Java with cross-compiled JavaScript presentation layer using &lt;a href="http://code.google.com/webtoolkit/"&gt;GWT&lt;/a&gt;, eg &lt;a href="http://www.vectomatic.org/gwt/lib-gwt-svg-edu/lib-gwt-svg-edu.html"&gt;SVG-EDU&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/54/svg-edu"&gt;[MGO2010]&lt;/a&gt; or  &lt;a href="http://zulu.binbash.eu/"&gt;Zulu&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/104/zulu"&gt;[MGO2010]&lt;/a&gt;. Main reason people used Flash in their games was enabling sound effects (like &lt;a href="http://sinuousgame.com/"&gt;Sinuous&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/131/sinuous"&gt;[MGO2010]&lt;/a&gt;, the winner of &lt;a href="http://10k.aneventapart.com/"&gt;10kApart&lt;/a&gt;). But &lt;a href="http://www.wilfscorner.co.uk/games/wizardwars/"&gt;Wizard Wars&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/97/wizard-wars"&gt;[MGO2010]&lt;/a&gt; used &lt;a href="http://www.schillmania.com/projects/soundmanager2/"&gt;SoundManager2&lt;/a&gt; to achieve same effect. &lt;a href="http://www.refuture.eu/madtanks/"&gt;Mad Tanks TD&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/132/mad-tanks-td"&gt;[MGO2010]&lt;/a&gt;, one of my personal favorites in the competition, uses &lt;a href="http://lesscss.org/"&gt;LESS&lt;/a&gt;, which "&lt;i&gt;extends CSS with variables, mixins, operations and nested rules&lt;/i&gt;". Looks cool! (both, the game and the compiler:) ). I was impressed with amount of WebGL based games. In &lt;a href="http://redshootinghood.info/"&gt;Red shooting Hood&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/146/red-shooting-hood"&gt;[MGO2010]&lt;/a&gt;, made by &lt;a href="http://dragomir.org"&gt;Tymon Zgaiński&lt;/a&gt; from Poland, member of polish gameDev community &lt;a href="http://warsztat.gd/"&gt;Warsztat&lt;/a&gt;, I found &lt;a href="http://sylvester.jcoglan.com/"&gt;Sylvester&lt;/a&gt;, "&lt;i&gt;Vector and Matrix math for JavaScript&lt;/i&gt;". Open web implementation of simple and well known &lt;a href="http://weup.sourceforge.net/demos/rm/rm.html?app=Froggger"&gt;Frogger&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/165/frogger"&gt;[MGO2010]&lt;/a&gt; was compiled to Javascript &amp; canvas using &lt;a href="http://weup.sourceforge.net/demos/rm/"&gt;Ristretto Mobile&lt;/a&gt;, "&lt;i&gt;a Web-based Compiler for Running Interactive Games and Simulations&lt;/i&gt;". My own entry, &lt;a href="http://openodyssey.mibbu.eu/"&gt;OpenOdyssey&lt;/a&gt; &lt;a href="https://gaming.mozillalabs.com/games/108/openodyssey"&gt;[MGO2010]&lt;/a&gt;was made simultaneous with &lt;a href="http://mibbu.eu"&gt;Mibbu&lt;/a&gt; framework and is based on it. I'm not satisfied with the final result, but I will develop both after the competition. If I will find some free time during the weekend I will write few words about &lt;a href="http://openodyssey.mibbu.eu"&gt;OO&lt;/a&gt; &amp; &lt;a href="http://mibbu.eu"&gt;Mibbu&lt;/a&gt;.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/38645oo.png" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-941557798723833032?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/941557798723833032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/01/mozilla-game-on-2010.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/941557798723833032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/941557798723833032'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/01/mozilla-game-on-2010.html' title='Mozilla Game On 2010'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-2303114614627915021</id><published>2011-01-12T17:23:00.000-08:00</published><updated>2011-01-12T17:28:04.245-08:00</updated><title type='text'>Facebook Hackers Cup eliminations</title><content type='html'>Last weekend I was participating in the elimination part of Facebook Hacker Cup. There were three problems to solve and it was obligatory to finish at least one. Since it was last weekend before Mozilla GameOn 2010 deadline, I had no time for solving academical, non-real life, algorithmic problems I was always poor in. So I just took a look to &lt;a href="http://www.facebook.com/hackercup/problems.php?round=4"&gt;the first one&lt;/a&gt; &lt;a href="http://pastebin.com/raw.php?i=0FHbbpUt"&gt;[mirror]&lt;/a&gt;. It looked quite easy, and in couple of minutes I had kind of prototype algorithm implemented in pure Javascript. Main idea of the problem was that the biggest number which square could be part of the input, cannot be bigger than square root of the input divided by two. So I simply iterate from 1 to that max, and in each iteration I checked square root of input number reduced by square of 'i'. If it was integer, we have sum of two squares. If float, we haven't. Piece of cake:). My Javascript implemetation in Rhino (&lt;a href="http://michalbe.blogspot.com/2011/01/javascript-from-command-line-standard.html"&gt;as I described before&lt;/a&gt;):&lt;br /&gt;&lt;pre name="code" class="js"&gt;var check = function(input) {&lt;br /&gt;    var result = 0,&lt;br /&gt;        max = Math.sqrt(input/2);&lt;br /&gt;&lt;br /&gt;    if(Math.sqrt(input)%1==0) {&lt;br /&gt;        result++;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    for(i=1;i &lt;= max;i++) {&lt;br /&gt;        if(Math.sqrt((input-Math.pow(i, 2)))%1==0) {&lt;br /&gt;            result++;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    return result;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;var MainFunction = function(args) {&lt;br /&gt;    var a = readFile(args).split("\n");&lt;br /&gt;&lt;br /&gt;    for (var i=1, j=a.length;i &lt; j ;i++) {&lt;br /&gt;        print(check(a[i]));&lt;br /&gt;    }&lt;br /&gt;}(arguments);&lt;br /&gt;&lt;/pre&gt;&lt;img src="http://images.virtualdesign.pl/images/67510fb.png" width="430" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-2303114614627915021?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/2303114614627915021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/01/facebook-hackers-cup-eliminations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/2303114614627915021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/2303114614627915021'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/01/facebook-hackers-cup-eliminations.html' title='Facebook Hackers Cup eliminations'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4052689414929821140</id><published>2011-01-07T14:34:00.000-08:00</published><updated>2011-01-08T04:19:34.299-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='ideone'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='command line'/><category scheme='http://www.blogger.com/atom/ns#' term='spidermonkey'/><category scheme='http://www.blogger.com/atom/ns#' term='rhino'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='hackers'/><title type='text'>JavaScript from command line - standard input &amp; output</title><content type='html'>As you could already know from Mr. C's &lt;a href="http://developer.yahoo.com/yui/theater/video.php?v=crockford-loopage"&gt;lectures from YUI Theater&lt;/a&gt; or &lt;a href="http://front-trends.com/"&gt;FrontTrends&lt;/a&gt; - &lt;a href="http://img651.imageshack.us/img651/8146/20379157.jpg"&gt;&lt;img src="http://img651.imageshack.us/img651/8146/20379157.jpg" width="300" style="float:right;margin-left:10px;"&gt;&lt;/a&gt;standard I/O is the worst thing programming languages could ever implement. Fortunately - Javascript has no input at all. And in most cases it doesn't need any - it was designed as script language for web pages. But nowadays we use Javascript in any other aspects of our programming life - we can build for desktops using &lt;a href="https://developer.mozilla.org/En/XUL"&gt;XUL&lt;/a&gt;, server-side tools like &lt;a href="http://nodejs.org/"&gt;node.js&lt;/a&gt; (for example with announced last week &lt;a href="http://www.jspp.io/"&gt;JSPP&lt;/a&gt;) or &lt;a href="http://en.wikipedia.org/wiki/Comparison_of_Server-side_JavaScript_solutions"&gt;any other Server-side Javascript implemenation&lt;/a&gt; provide JS backend for the web, native mobile apps could be created using frameworks like &lt;a href="http://www.phonegap.com/"&gt;Phonegap&lt;/a&gt;. So what about executing JS scripts from command line? And why do we need it?&lt;img src="http://img706.imageshack.us/img706/7118/59130076.jpg" width="430"/&gt;&lt;br /&gt;The reason I've refreshed my experiences with JS scripts executing was &lt;a href="http://www.facebook.com/#!/hackercup"&gt;Hacker Cup organized by Facebook&lt;/a&gt; - there are no language restrictions in there, your scripts just has to know how to analyze given input and write the answers on the standard output. It is quite unpopular way of using &amp; writing Javascript, so I will show few tips of command line in here.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Engines&lt;/b&gt;&lt;br /&gt;There is such a JavaScript engine called &lt;a href="http://www.mozilla.org/rhino/"&gt;Rhino&lt;/a&gt;. It is completely written in Java, open source, and very easy to use. It is managed by Mozilla, so you can find a lot of docs and tutorials on &lt;a href="http://www.google.com/cse?cx=002443141534113389537%3Aysdmevkkknw&amp;cof=FORID%3A0&amp;q=rhino&amp;x=0&amp;y=0"&gt;Mozilla's page&lt;/a&gt;. &lt;br /&gt;Rhino has few additional functions eg for working with files (&lt;a href="https://developer.mozilla.org/en/Rhino_Shell#readFile%28path_.5b.2c_characterCoding.5d%29"&gt;readFile()&lt;/a&gt;) or serializing objects (&lt;a href="https://developer.mozilla.org/en/Rhino_Shell#serialize%28object.2c_filename%29"&gt;serialize()&lt;/a&gt;), which makes it useful in solving algorithmic problems in competitions like FBHC. Full list of all shell function can be found on &lt;a href="https://developer.mozilla.org/en/Rhino_Shell"&gt;Mozilla's page&lt;/a&gt;.&lt;br /&gt;Each time you run Javascript scripts from command line, all the arguments you provide will be stored in global variable called '&lt;i&gt;arguments&lt;/i&gt;'. Enriched with this knowledge we can begin with some examples. This is my implementation of binarySearch algorithm:&lt;br /&gt;&lt;pre name="code" class="js"&gt;Array.prototype.binSearch = function(element) {&lt;br /&gt;    var element = parseInt(element, 10), &lt;br /&gt;        left = 0,  &lt;br /&gt;        right = this.length-1,&lt;br /&gt;        middle = ~~((left+right)/2),&lt;br /&gt;        lastMiddle;&lt;br /&gt;&lt;br /&gt;    while (parseInt(this[middle], 10) !== element) {&lt;br /&gt;    &lt;br /&gt;        if (lastMiddle === middle) {&lt;br /&gt;            return null; //nothing found, break&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        if (parseInt(this[middle], 10) &lt; element)&lt;br /&gt;            left = middle++;&lt;br /&gt;        else &lt;br /&gt;            right = middle--;&lt;br /&gt;        &lt;br /&gt;        lastMiddle = middle;&lt;br /&gt;        middle = Math.round((left+right)/2); &lt;br /&gt;    }        &lt;br /&gt;    return middle; //index of found element &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var MainFunction = function(args) {&lt;br /&gt;&lt;br /&gt;    var a = readFile(args).split("\n"),&lt;br /&gt;        arrayElement = a[0].split(" "),&lt;br /&gt;        result;&lt;br /&gt;    &lt;br /&gt;   &lt;br /&gt;    print("Array: "+arrayElement);&lt;br /&gt;    &lt;br /&gt;    for (var i=1, j=a.length;i &lt; j;i++) {&lt;br /&gt;        result = arrayElement.binSearch(a[i]);&lt;br /&gt;        if (result) &lt;br /&gt;            print("Element "+parseInt(a[i], 10)+" in on position nr "+result);&lt;br /&gt;        else &lt;br /&gt;            print("Element "+parseInt(a[i], 10)+" cannot be found in the array");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}(arguments)&lt;br /&gt;&lt;/pre&gt;As an input it takes filename with the elements of an array in first row and elements to find in that array in next rows, like this:&lt;pre name="code" class="js"&gt;4 10 12 19 25 34 41 50 52 61 66 68 76 81 82 85 94 97 105 112 115 124 128 138 139 230 321 432 456 540 &lt;br /&gt;61&lt;br /&gt;82&lt;br /&gt;94&lt;br /&gt;2&lt;br /&gt;10&lt;br /&gt;4&lt;br /&gt;24&lt;br /&gt;432&lt;br /&gt;&lt;/pre&gt;Assuming that script file is called binSearch.js, data.txt is the file with input data, and both are in the same directory as Rhino, to run the script simply type&lt;pre name="code" class="js"&gt;java -jar js.jar binSearch.js data.txt&lt;/pre&gt;&lt;a href="http://img18.imageshack.us/img18/1216/rhinop.png"&gt;&lt;img src="http://img18.imageshack.us/img18/1216/rhinop.png" width="430"/&gt;&lt;/a&gt;&lt;b&gt;Ideone&lt;/b&gt;You can simply achieve the same effect using online tools\, without installing anything on your computer. &lt;a href="http://ideone.com"&gt;Ideone&lt;/a&gt;, online IDE &amp; debugging tool allows you to run your scripts using Rhino or &lt;a href="http://www.mozilla.org/js/spidermonkey/"&gt;SpiderMonkey&lt;/a&gt;, another Mozilla's JS engine, this one written in C. You can edit your scripts in realtime and provide different inputs on every run.&lt;a href="http://img690.imageshack.us/img690/7807/ideone.png"&gt;&lt;img src="http://img690.imageshack.us/img690/7807/ideone.png" width="430" /&gt;&lt;/a&gt;Good luck in FBHC!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4052689414929821140?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4052689414929821140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2011/01/javascript-from-command-line-standard.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4052689414929821140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4052689414929821140'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2011/01/javascript-from-command-line-standard.html' title='JavaScript from command line - standard input &amp; output'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-3040833198671840157</id><published>2010-12-22T14:59:00.000-08:00</published><updated>2011-01-08T03:47:42.289-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><title type='text'>iPad etc.</title><content type='html'>Today I had my first touch with most hated mobile device ever - Apple iPad. I won internal &lt;a href="http://dev.gg.pl/konkurs/"&gt;contest&lt;/a&gt; organized by my employer, &lt;a href="http://www.gadu-gadu.pl/"&gt;GG Network&lt;/a&gt;. It was all about creating application using new API of &lt;a href="http://gg.pl"&gt;GG social site&lt;/a&gt;. If someone is interested - public edition of the competition end on 31 of December and you can win 30.000PLN (about 10000$). In week, maybe two I will write something more about the API and publishing apps on GG.pl (it has more than 10 millions of users and just about 50 apps so far - best way for promoting your apps).&lt;br /&gt;&lt;img src="http://img815.imageshack.us/img815/4897/ipad2.jpg" width="430" /&gt;&lt;br /&gt;There were thousands of iPad's reviews all over the web, so I want to write one single sentence from gamedeveloper's point of view. Porting one of my Javascript game to run on the device took me about 7 minutes - I add simple code for screen size detection, now it is possible to run 'Zombie Eliminator' in any browser, without resolution issues. It is the biggest advantage of Javascript programming - it will run on different platforms out of the box. When I will finish my Game On entry I will try to write something more about iPad gamedev.&lt;br /&gt;&lt;img src="http://img84.imageshack.us/img84/8264/ipadx.jpg" width="430" /&gt;&lt;br /&gt;Oh, and my new game is available in SamsungApps since yesterday - tetris-like logic puzzle with jewels - &lt;a href="http://www.samsungapps.com/topApps/topAppsDetail.as?productId=G00000313758"&gt;try it here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-3040833198671840157?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/3040833198671840157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/12/ipad-etc.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3040833198671840157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3040833198671840157'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/12/ipad-etc.html' title='iPad etc.'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4160826200630917826</id><published>2010-11-12T13:20:00.000-08:00</published><updated>2011-02-27T01:22:34.425-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='dom'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='game mechanics'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='SGWH5'/><title type='text'>Using css3 transformations for sprite animation</title><content type='html'>Inspired by &lt;a href="http://twitter.com/kamiltrebunia"&gt;Kamil Trebunia&lt;/a&gt;'s speech on FrontTrends so as "&lt;a href="http://www.google.com/events/developerday/2010/munich/sessions/practical-html5.html"&gt;Practical HTML5&lt;/a&gt;" presentation by &lt;a href="http://www.google.com/events/developerday/2010/munich/speakers.html#jeremy-orlow"&gt;Jeremy Orlow&lt;/a&gt; &amp; &lt;a href="http://twitter.com/cramforce"&gt;Malte Ubl&lt;/a&gt; on &lt;a href="http://www.google.com/events/developerday/2010/munich/"&gt;Google Developer Day in Munich&lt;/a&gt; two days ago, I decide to test if using transformations provided by CSS3 really improves performance of JavaScript games for mobile devices. Kamil said about fastest page redrawing using &lt;i&gt;translate&lt;/i&gt; instead of &lt;i&gt;position absolute &amp; top/left&lt;/i&gt; attributes. Google guys presented css3 transformations with hardware acceleration. It looks nice so I made a little performance test.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/57891scr1.jpg" style="float:right;margin-left:10px;width:180px;" /&gt;I create simple 'Frames per seconds' counter and run it with 100 animated sprites, each with 4 frames (actually every sprite has 8 frames, but I used only 4 of them) and random movement. The sprites were penguins drawn by me some time ago, based on &lt;a href="http://strategywiki.org/wiki/Antarctic_Adventure"&gt;Antarctic Adventures&lt;/a&gt; for NES (one of my favorite games back in '90). I made three tests on my Samsung bada - one using canvas for rendering everything, second one with '&lt;a href="http://michalbe.blogspot.com/2010/10/four-methods-of-javascript-animation.html"&gt;Div with overflow:hidden&lt;/a&gt;' method I described in one of the latest posts, and the third one similar to 2nd, but with css3 translation instead of top/left changes. The result was quite surprising -  classical DOM manipulation animation had &lt;b&gt;11-12fps&lt;/b&gt;, Css3 transition method reached &lt;b&gt;10-13fps&lt;/b&gt;, and canvas rendering about &lt;b&gt;27fps&lt;/b&gt;. I know that there is wrong way of thinking somewhere, but I have no idea what exactly goes wrong. &lt;b&gt;Any suggestions?&lt;/b&gt; You can find the source on my github account: [&lt;a href="https://github.com/michalbe/animation-using-css3-transform"&gt;michalbe&lt;/a&gt;]&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/60394scr2.jpg" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4160826200630917826?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4160826200630917826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/11/using-css3-transformations-for-sprite.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4160826200630917826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4160826200630917826'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/11/using-css3-transformations-for-sprite.html' title='Using css3 transformations for sprite animation'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-8106584522095722588</id><published>2010-10-23T06:04:00.000-07:00</published><updated>2010-10-23T07:00:30.161-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Front Trends'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='conference'/><title type='text'>Front Trends 2010 in a few words - 2nd day</title><content type='html'>First day of FT2010 was described &lt;a href="http://michalbe.blogspot.com/2010/10/front-trends-2010-in-few-words.html"&gt;[here]&lt;/a&gt;. Now let me share my experiences from the second one.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/62108ft1.jpg" /&gt;&lt;br /&gt;First speech of the second day of Front Trends was opened by &lt;a href="http://twitter.com/jaffathecake"&gt;Jake Archibald&lt;/a&gt;. It was all about designing and creating flexible APIs. We learned that API needs to be designed before any code is written - otherwise young boys will watch movies about cocks with their mothers. Also - good API is like Patrick Stewart (who hates PHP) and most of the world's problems are caused by Java. Jake discussed also different use cases of typical API on the example of creating the carousel element on the web page. It was one of the most interesting presentations during the FT - both in terms of content and form. Great job! [watch it &lt;a href="http://vimeo.com/15984466"&gt;here&lt;/a&gt;]&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/32161ft1.jpg" /&gt;&lt;br /&gt;Another lecture was prepared by &lt;a href="http://twitter.com/cjno"&gt;Christian Johansen&lt;/a&gt;. He presented the idea of Test Driven Development using Live Search jQuery plugin as an example. There was a bit of theory and a lot of live coding.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/51496ft1.jpg" /&gt;&lt;br /&gt;I was really looking forward for the &lt;a href="http://www.phonegap.com/"&gt;PhoneGap&lt;/a&gt; speech by &lt;a href="http://twitter.com/KamilTrebunia"&gt;Kamil Trebunia&lt;/a&gt;, former employee of Nokia. He started with advantages of cross-device development and presented basic aspects of creating applications using HTML5 techniques. Then showed crossmobile tools like Phonegap or Titanium Mobile with their pros &amp; cons. After discussing jQuery Mobile and Sencha Touch as examples of JS mobile frameworks Kamil shows few hacks and tricks for performance boost, like optimizing reflows (using CSS3 transformations instead of changing absolute style attributes like positions or margins, etc.). After the speech we had nice talk about future of cross mobile development together with &lt;a href="http://twitter.com/twtomcat"&gt;Markus Leutwyler&lt;/a&gt; and one Wikipedia guy from Italy, unfortunately I forgot his name. &lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/34494ft1.jpg" /&gt;&lt;br /&gt;Another very interesting speech was prepared by Professor of Mechanical Engineering from Dortmund University of Applied Sciences and Arts, &lt;a href="http://goessner.net/"&gt;Stefan Gössner&lt;/a&gt;. He began his speech with the question - why not to use modified physics engines for games, like Box2d, in scientific simulations? And, in addition, why not to make it as a web application using Javascript &amp; Canvas? Results of his work was amazing - prof. Stefan presented couple of real life examples of mechanical simulations, like solid body on a spring, typewriter or Mercedes Benz's wipers mechanism. Everything works smooth, fast and most importantly - it looked convincingly. Rest of the talk he was describing different representations of physics data like vectors, matrices etc., everything supported with performance tests.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/73259ft1.jpg" /&gt;&lt;br /&gt;&lt;a href="http://twitter.com/ppk"&gt;Peter-Paul Koch&lt;/a&gt;, author of the well known &lt;a href="http://quirksmode.org/"&gt;Quirksmode.org&lt;/a&gt; was the last speaker at Front Trends. He was generally talking about the future of the mobile apps - about 10$ smartphones available worldwide in 2018, about ridiculous at least 41 App Stores, free HTML5 apps with paid content, shared via Bluetooth on wide variety of devices and systems. Ppk mentioned also some hypothetical javascript mobile browser's events, like onphonecall or oncompasspointnorth and gives examples of using them in real life applications. He also answered lot of questions about his vision of the mobile future and some less clever also ( - You think iPad is more mobile or desktop device?  - Yes.).&lt;br /&gt;&lt;br /&gt;Unfortunately I was not able to be present on all of the lectures - I regret the most "Mobile UX and current trends in mobile design" by &lt;a href="http://twitter.com/ribot"&gt;Anthony Ribot&lt;/a&gt;. If there is any video from that one please publish it somewhere!&lt;br /&gt;&lt;br /&gt;I would like to thank anyone I was talking with. Also organizers for that awesome event. And guys from PALM for my PRE phone (I hope so, it still stuck at customs:) ). It was exciting to meet first league of world's frontend developers not even leaving my own city. I hope I will feel the same after &lt;a href="http://falsyvalues.com"&gt;FalsyValues&lt;/a&gt;!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-8106584522095722588?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/8106584522095722588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/10/front-trends-2010-in-few-words-2nd-day.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/8106584522095722588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/8106584522095722588'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/10/front-trends-2010-in-few-words-2nd-day.html' title='Front Trends 2010 in a few words - 2nd day'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-6784367543671751938</id><published>2010-10-21T12:40:00.000-07:00</published><updated>2010-10-23T06:13:53.525-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Front Trends'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='conference'/><title type='text'>Front Trends 2010 in a few words</title><content type='html'>First day of &lt;a href="http://front-trends.com/"&gt;Front Trends&lt;/a&gt; conference is behind us now. First time ever so many JavaSript 'gurus' met in Poland. As the participant of this event I would like to write a few words about it.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/34744ft1.jpg" /&gt;&lt;br /&gt;Conference was opened by the organizers - &lt;a href="http://ferrante.pl/"&gt;Damian Wielgosik&lt;/a&gt; &amp; Pawel Czerski. They said few words about the dreams, writing anonymous emails to famous people, and organizing conference from scratch. I respect Damian for everything he is making for Javascript community, but that part looks really bad. It was delayed, unprepared, and above all just uninteresting for the developers. Searching for &lt;a href="http://search.twitter.com/search?q=%23ft2010"&gt;#ft2010&lt;/a&gt; on twitter just after it starts I could read a lot of comment like that. &lt;br /&gt;But the worst part of the opening was short speech made by ZlapTaxi guy, who said at the beggining that if you want to make cross-mobile application you have to build huge team of Java, Objective-C, Symbian C, Cpp and God only knows what other developers (have you ever heard of &lt;a href="http://www.phonegap.com/"&gt;PhoneGap&lt;/a&gt;? Oh, sorry, it was next presentation and it is so hard to read all that up to date stuff in the &lt;a href="http://lmgtfy.com/?q=cross+mobile+applications"&gt;Internet&lt;/a&gt;). After explaining how to use his catch-a-taxi app and announcing a contest, he state that if you will find girl in Front Trends tshirt somewhere there, she could helps you order a taxi. So why he build that app for if there are girls to do this? Never mind.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/66493ft2.jpg" /&gt;&lt;br /&gt;First speech I was attending in was "You know webOS" by &lt;a href="http://twitter.com/twtomcat"&gt;Markus Leutwyler&lt;/a&gt;. Markus presented webOs history, main tasks, and devices that webOS is running on (even kind of printer with that Os - sick!). After that he discussed basics of webOs development - Mojo framework, building and connecting Scenes &amp; Controllers. He finished with few words about jailbreaking and rooting Palm devices, testing &amp; packaging created apps. Everything was clear and nice (especially I like his pronunciation of the name "webOS", maybe it is Swiss accent or something, I'm not sure:) ), but if you ever create even one simple webOs application - you already know everything Markus was talking about. For sure - if I hadn't written anything on webOS before,I would start after this lecture! &lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/37153ft3.jpg" /&gt;&lt;br /&gt;In the second talk &lt;a href="http://twitter.com/robertnyman"&gt;Robert Nyman&lt;/a&gt; showed us main features of HTML5. He said a little about history of language, coercion, falsy values, video and audio elements and it's hacks, few words about webstorage and cookies and gives us nice example of FileAPI. Each comparison of 'old' methods and 'brand new HTML5' manner was served in funny, enjoyable way, with a lot of Forrest Gump or other pop culture references (Why Rachel from "the Friends" sitcom was sad after her boyfriend left her? Because she needs &lt;a href="http://robertnyman.com/2008/10/09/explaining-javascript-scope-and-closures/"&gt;closure&lt;/a&gt;!)  &lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/80560ft4.jpg" /&gt;&lt;br /&gt;&lt;a href="https://twitter.com/WebReflection"&gt;Andrea Giammarchi&lt;/a&gt; a.k.a. &lt;a href="http://webreflection.blogspot.com"&gt;WebReflection&lt;/a&gt; prepared nice speech about Javascript performance on different devices. He showed us couple of performance tests and explained each one. As the summary of the talk he state that if you want you app to run fastest as possible you have to create it for given browser and use browser-specific hacks for performance boost. Check &lt;a href="http://webreflection.blogspot.com/2010/10/front-trends-2010-my-talk.html"&gt;Andrea's blog&lt;/a&gt; for more details.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/16538ft5.jpg" /&gt;&lt;br /&gt;Before the lecture of &lt;a href="http://twitter.com/getify"&gt;Kyle Simpson&lt;/a&gt; I was wondering, what is that all Javascript Middle-end stuff about. He explained everything using nice, simple slides and charts in about a half of his time. Starting from traditional MVC architecture (the "boring" one) he presents new Clients Views Controllers architecture in which all the logic made in the templates before, is now moved to the middle-end layer. In this manner of creating web applications there are no single condition or equation in the templates. Sounds great. Next he showed sources of his &lt;a href="http://shortie.me/"&gt;Shortie.me&lt;/a&gt; page build using his &lt;a href="http://github.com/getify/BikechainJS"&gt;Bikechain.js&lt;/a&gt; - minimal server-side JavaScript wrapper environment.&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/91074ft6.jpg" /&gt;&lt;br /&gt;Last speech for today was prepared by &lt;a href="http://crockford.com/"&gt;Douglas Crockford&lt;/a&gt;. I must say that I was a little bit disappointed - I've already seen this! His "Javascript server-side" lecture was modified version of his &lt;a href="http://developer.yahoo.com/yui/theater/video.php?v=crockford-loopage"&gt;Loopage&lt;/a&gt; presentation from YUI Theater. Yes, I know - that is all my false - I watch every Crockford's video available on the Internet. &lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/56308ft6.jpg" /&gt; Undeniably - the best part of today's event was Panel Discussion with &lt;a href="http://twitter.com/t"&gt;Tantek Celik&lt;/a&gt;, &lt;a href="http://twitter.com/ppk"&gt;Peter-Paul Koch&lt;/a&gt; &amp; &lt;a href="http://crockford.com/"&gt;Mr Crockford&lt;/a&gt;. It was more than one and a half hour of pure Javascript discussion, so it is impossible to quote everything. Most interested things I've learned from the panel:&lt;br /&gt;- differences between API's and implementations are consequence of using technology before specification is finished,&lt;br /&gt;- Flash took place in the web market because HTML was not able to make awesome things. Now it is, so we have to forget about Flash,&lt;br /&gt;- web developers are the most stupid and the laziest people ever&lt;br /&gt;- people are watching so much porn that they have to download JS libraries each time they visit site that is using it:)&lt;br /&gt;- and if you want to be good JS developer you must use js frameworks and you couldn't use it simultaneously.&lt;br /&gt;&lt;br /&gt;Tomorrow second day. I'm really looking forward for it!&lt;br /&gt;&lt;br /&gt;UPDATE: read next part &lt;a href="http://michalbe.blogspot.com/2010/10/front-trends-2010-in-few-words-2nd-day.html"&gt;[here]&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-6784367543671751938?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/6784367543671751938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/10/front-trends-2010-in-few-words.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6784367543671751938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6784367543671751938'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/10/front-trends-2010-in-few-words.html' title='Front Trends 2010 in a few words'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-7820076941759166834</id><published>2010-10-15T10:44:00.000-07:00</published><updated>2010-10-18T15:25:26.807-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='dom'/><category scheme='http://www.blogger.com/atom/ns#' term='game mechanics'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><title type='text'>Four methods of Javascript animation</title><content type='html'>&lt;img src="http://images.virtualdesign.pl/images/78335sprite.jpg" style="float:right;width:30px;margin-left:15px" /&gt;Quoting Wikipedia: &lt;br /&gt;&lt;blockquote&gt;Animation is the rapid display of a sequence of images in order to create an illusion of movement.&lt;/blockquote&gt;&lt;br /&gt;There are few methods to achieve that effect in JS, and I will discuss four of them in here. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;1. Canvas animation&lt;/b&gt;&lt;br /&gt;I used canvas animation in my &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Javascript game tutorial&lt;/a&gt;, but let's describe it once again. As an example, I will animate jump frames from my very favorite game days ago, Prince of Persia, you can find it on the right side of the post. &lt;br /&gt;Before stating any animation related stuff it's necessarily to define few variables common for all four methods. Let's do this:&lt;pre name='code' class = 'js'&gt;var width = 100,&lt;br /&gt;    height = 86,&lt;br /&gt;    frames = 10, &lt;br /&gt;//our PoP jumping animation has 11 frames, but we count from 0&lt;br /&gt;    &lt;br /&gt;    actualFrame = 0,&lt;br /&gt;       &lt;br /&gt;    posX = 100,&lt;br /&gt;    posY = 100,&lt;br /&gt;//X &amp; Y position of the element&lt;br /&gt;&lt;br /&gt;    canvas = document.createElement('canvas'),&lt;br /&gt;//'canvas' variable will be always main element of an animation, not always &lt;canvas&gt; type&lt;br /&gt;    canvasStyle = canvas.style,&lt;br /&gt;    ctx = canvas.getContext("2d"),&lt;br /&gt;    image = document.createElement('img');&lt;br /&gt; &lt;br /&gt;    image.src = 'sprite.jpg';&lt;br /&gt; &lt;br /&gt;    canvasStyle.position = "absolute";&lt;br /&gt;    canvasStyle.top = posX;&lt;br /&gt;    canvasStyle.left = posY;&lt;br /&gt;&lt;br /&gt;    canvas.width = width;&lt;br /&gt;    canvas.height = height;&lt;br /&gt;//width &amp; height are assigned directly to th canvas, not to the canvasStyle because in the other case it would scale the element, not change its size.&lt;br /&gt;    document.body.appendChild(canvas);&lt;br /&gt; &lt;br /&gt;var draw = function(){&lt;br /&gt;//main function for rendering each frame, here will all the animation logic goes.&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;setInterval(draw, 80);&lt;br /&gt;//main loop        &lt;br /&gt;&lt;/pre&gt;To animate our character we need just to display next frames of the jump on the canvas. It's not necessarily to clear whole surface each time in this particular case, because it has the same size as single frame. The draw function will looks like that:&lt;pre name='code' class = 'js'&gt;var draw = function(){&lt;br /&gt;    ctx.drawImage(image, 0, height * actualFrame, width, height, 0, 0, width, height);&lt;br /&gt;//the attributes are: image to draw, X coord of the source image, Y coord of the source image, width &amp; height of the cut piece (frame size), X &amp; Y destination coords (our canvas) and destination frame size (not always the same as the source one, eg in case of scaling the frame)&lt;br /&gt;&lt;br /&gt;    if (actualFrame == frames) {&lt;br /&gt;        actualFrame = 0;&lt;br /&gt;    } else {&lt;br /&gt;        actualFrame++;&lt;br /&gt;    }&lt;br /&gt;//looping the frames, it is also the common part of all draw() function in this post&lt;br /&gt;} &lt;br /&gt;&lt;/pre&gt;So that is the first method of JavaScript animation.&lt;br /&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br /&gt;- it uses canvas (the future of HTML5 games)&lt;br /&gt;- it's possible to scale, rotate, flip, etc. the frames in browsers that support canvas but no CSS3&lt;br /&gt;- probably much more&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br /&gt;- need to clear whole canvas to draw another frame&lt;br /&gt;- not supported in old browsers&lt;br /&gt;- quite complex math for display single frame&lt;br /&gt;&lt;br /&gt;Life example: &lt;a href="http://jsbin.com/okuki3"&gt;[1. Canvas Animation]&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Background looping&lt;/b&gt;&lt;br /&gt;I think it was one of the firstmethods of sprite's animation in web browsers. It is the simplest way ever. Just create div element with background, and change backgroundPosition on each frame. Piece of cake. Try:&lt;br /&gt;&lt;pre name='code' class = 'js'&gt;var canvas = document.createElement('div'),&lt;br /&gt;//div element is now our 'canvas'&lt;br /&gt;    canvasStyle = canvas.style;&lt;br /&gt;    &lt;br /&gt;    canvasStyle.backgroundImage = "url(sprite.jpg)";&lt;br /&gt;//and our image is just it's background&lt;br /&gt;    canvasStyle.position = "absolute";&lt;br /&gt;    canvasStyle.top = posX;&lt;br /&gt;    canvasStyle.left = posY;&lt;br /&gt;&lt;br /&gt;    canvasStyle.width = width;&lt;br /&gt;    canvasStyle.height = height;&lt;br /&gt;//width &amp; height are now assigned to the 'style', not directly to the element&lt;br /&gt;    document.body.appendChild(canvas);&lt;br /&gt;    &lt;br /&gt;var draw = function(){&lt;br /&gt;    canvasStyle.backgroundPosition = "0 -"+height * actualFrame;&lt;br /&gt;//each frame background image moves up, that's why there is minus sign before the value, you can multiply (height * actualFrame) by negative one, it gives the same effect&lt;br /&gt;(...) //here goes frame changing logic from the 1st example&lt;br /&gt;}&lt;/pre&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br /&gt;- simplicity&lt;br /&gt;- works everywhere&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br /&gt;- not possible to scale, rotate, etc. without CSS3&lt;br /&gt;&lt;br /&gt;Example: &lt;a href="http://jsbin.com/ovuqu6"&gt;[2. Background looping animation]&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. Clip-rect method&lt;/b&gt;&lt;br /&gt;Hmm, but what when we wan't our game to run on full screen, or on different devices with various resolutions? Changing size of the div from second example gives nothing, just looks ugly. So this is where I introduce &lt;i&gt;clip:rec()&lt;/i&gt;, Css attribute of img element. Quoting W3schools:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;The clip property lets you specify the dimensions of an absolutely positioned element that should be visible, and the element is clipped into this shape.&lt;/blockquote&gt;&lt;br /&gt;Let's try:&lt;br /&gt;&lt;pre name='code' class = 'js'&gt;var canvas = document.createElement('img'),&lt;br /&gt;//image is not the canvas&lt;br /&gt;    canvasStyle = canvas.style;&lt;br /&gt;    &lt;br /&gt;    canvas.src = 'sprite.jpg';&lt;br /&gt;(...)//rest of the attributes&lt;br /&gt;var draw = function(){&lt;br /&gt;    var frameTop = height * actualFrame, &lt;br /&gt;        frameLeft = 0, &lt;br /&gt;        frameRight = width, &lt;br /&gt;        frameBottom = frameTop + height;&lt;br /&gt;//a little math here for each frame&lt;br /&gt;                                 &lt;br /&gt;    canvasStyle.clip = "rect("&lt;br /&gt;        +frameTop +"px " //top&lt;br /&gt;        +frameRight +"px " //right&lt;br /&gt;        +frameBottom +"px " //bottom&lt;br /&gt;        +frameLeft +"px )"; //left&lt;br /&gt;                                      &lt;br /&gt;    canvasStyle.top = posY - height * actualFrame;&lt;br /&gt;//IMPORTANT: even if we crop piece of source image, it's top &amp; left attrs dont change - it's necessarily to move it to the fixed position. That's what I made above.&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br /&gt;- only one element needed (just img)&lt;br /&gt;- possibility of scaling without CSS3&lt;br /&gt;- crossbrowser&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br /&gt;- not possible to rotate, flip, etc&lt;br /&gt;- very lot of math needed on each move/frame changing.&lt;br /&gt;&lt;br /&gt;Example: &lt;a href="http://jsbin.com/ehegi4"&gt;[3. Clip-rect method]&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4. Div with overflow:hidden&lt;/b&gt;&lt;br /&gt;The last way of animation I want to present is simplest than 3rd one, better than 2nd, and doesn't use canvas. The whole philosophy is to create one div element with image inside, display only part visible in div, and move the image in proper way. Like this:&lt;pre name='code' class = 'js'&gt;var canvas = document.createElement('div'),&lt;br /&gt;    canvasStyle = canvas.style,&lt;br /&gt;    image = document.createElement('img'),&lt;br /&gt;    imageStyle = image.style;&lt;br /&gt;    &lt;br /&gt;    image.src = 'sprite.jpg';&lt;br /&gt;//div is the 'canvas' now, but it has an image inside&lt;br /&gt;    &lt;br /&gt;    canvasStyle.position = imageStyle.position = "absolute";&lt;br /&gt;    canvasStyle.top = posX;&lt;br /&gt;    canvasStyle.left = posY;&lt;br /&gt;    canvasStyle.overflow = "hidden";&lt;br /&gt;//that is very important&lt;br /&gt;    canvasStyle.width = width;&lt;br /&gt;    canvasStyle.height = height;&lt;br /&gt;    &lt;br /&gt;    imageStyle.top = 0;&lt;br /&gt;    imageStyle.left = 0;&lt;br /&gt;    canvas.appendChild(image);&lt;br /&gt;    document.body.appendChild(canvas);&lt;br /&gt;//put image in the canvas/div and add it all to the body of the document.    &lt;br /&gt;var draw = function(){&lt;br /&gt;                                 &lt;br /&gt;    imageStyle.top = -1*height * actualFrame;&lt;br /&gt;//as in the 3rd example - direction of the move must be negative. Otherwise animation will be played backwards   &lt;br /&gt;    if (actualFrame == frames) {&lt;br /&gt;        actualFrame = 0;&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        actualFrame++;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;} &lt;/pre&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br /&gt;- possibility of scaling without CSS3&lt;br /&gt;- crossbrowser&lt;br /&gt;- much simpler than clip:rect()&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br /&gt;- not possible to rotate, flip, etc&lt;br /&gt;- two elements needed (img &amp; div)&lt;br /&gt;&lt;br /&gt;Example: &lt;a href="http://jsbin.com/efaxu3"&gt;[4. Div with overflow:hidden]&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Changing size of animated elements is very important in gamedev. So as simplicity. That's why in my new JS game engine I will implement both, canvas and overflow:hidden methods. You can find all the sources on my GitHub account: [&lt;a href="http://github.com/michalbe/js-anim"&gt;Javascript animation&lt;/a&gt;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-7820076941759166834?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/7820076941759166834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/10/four-methods-of-javascript-animation.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7820076941759166834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7820076941759166834'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/10/four-methods-of-javascript-animation.html' title='Four methods of Javascript animation'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-6175965182400217780</id><published>2010-09-30T03:29:00.000-07:00</published><updated>2011-02-27T10:47:20.358-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='game mechanics'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='SGWH5'/><title type='text'>Tutorial: Simple game with HTML5 Canvas - part 5</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;&lt;br /&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;&lt;br /&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;&lt;br /&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;&lt;br /&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;&lt;br /&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;First of all I want to thanks for the responses to my tutorial, all the comments, emails and tweets I receive. It's an awesome feeling - to be aware that someone is reading all that stuff and even likes it. Oh, and don't forget to follow me on Twitter - &lt;a href="http://twitter.com/michalbe"&gt;http://twitter.com/michalbe&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Part 5a. SCROLLING &amp; POINTS&lt;/span&gt;&lt;br /&gt;During the last lesson we teach our angel how to use platforms. Now let him jump higher than screen height. To obtain that we need to use trick as old as platform games - stop the character in one place and move everything else in opposite direction. In our example angel will stop in the middle of the screen and rest of the speed will move background and platforms down. Let's modify &lt;i&gt;checkJump()&lt;/i&gt; method of the &lt;i&gt;player&lt;/i&gt;:&lt;pre name='code' class = 'js'&gt;(...)&lt;br /&gt;that.checkJump = function() {     &lt;br /&gt;    if (that.Y &gt; height*0.4) {&lt;br /&gt;//if player is under about half of the screen - let him move&lt;br /&gt;        that.setPosition(that.X, that.Y - that.jumpSpeed);        &lt;br /&gt;    } else {&lt;br /&gt;//in other dont move player up, move platforms and circles down instead&lt;br /&gt;        MoveCircles(that.jumpSpeed * 0.5); &lt;br /&gt;//clouds are in the background, further than platforms and player, so we will move it with half speed&lt;br /&gt;        &lt;br /&gt;        platforms.forEach(function(platform, ind){&lt;br /&gt;            platform.y += that.jumpSpeed;&lt;br /&gt;&lt;br /&gt;            if (platform.y &gt; height) {&lt;br /&gt;//if platform moves outside the screen, we will generate another one on the top&lt;br /&gt;                var type = ~~(Math.random() * 5);&lt;br /&gt;                if (type == 0) &lt;br /&gt;                    type = 1;&lt;br /&gt;                else &lt;br /&gt;                    type = 0;&lt;br /&gt;                platforms[ind] = new Platform(Math.random() * (width - platformWidth), platform.y - height, type);&lt;br /&gt;            }&lt;br /&gt;        });&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    that.jumpSpeed--;&lt;br /&gt;    if (that.jumpSpeed == 0) {&lt;br /&gt;        that.isJumping = false;&lt;br /&gt;        that.isFalling = true;&lt;br /&gt;        that.fallSpeed = 1;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;When the platform moves outside the screen we will generates another one on the top, but not directly on 0-y, because we need to keep the distance between the platforms. So first we calculate how far it goes under the bottom, subtract hat value from total height and generate platform on that Y with random X. Yes, I know that it will show up suddenly in the middle of the screen, but while whole attention of the player is focused on the character, no one will notice that.&lt;br /&gt;Ok, it is possible now to jump as high as we want, but there are still couple of things to fix, eg difficulty level.&lt;br /&gt;To make everything harder let's give movement ability to some platforms. The higher your character will be, the faster platforms will move. To achieve this, first we will implement very simple points system, and after that modify a little &lt;i&gt;Platform&lt;/i&gt; object and &lt;i&gt;GameLoop()&lt;/i&gt; part responsible for drawing platforms.&lt;pre name='code' class = 'js'&gt;var width = 320, &lt;br /&gt;    height = 500,&lt;br /&gt;    gLoop,&lt;br /&gt;    points = 0,&lt;br /&gt;//adding points to global variables&lt;br /&gt;(...)&lt;br /&gt;&lt;br /&gt;var Platform = function(x, y, type){&lt;br /&gt;(...)&lt;br /&gt;    that.isMoving = ~~(Math.random() * 2);&lt;br /&gt;//first, let's check if platform will be able to move (1) or not (0)&lt;br /&gt;    that.direction= ~~(Math.random() * 2) ? -1 : 1;&lt;br /&gt;//and then in which direction&lt;br /&gt;(...)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;var GameLoop = function(){&lt;br /&gt;    clear();&lt;br /&gt;    DrawCircles();&lt;br /&gt;&lt;br /&gt;    if (player.isJumping) player.checkJump();&lt;br /&gt;    if (player.isFalling) player.checkFall();&lt;br /&gt; &lt;br /&gt;    player.draw();&lt;br /&gt;//moving player.draw() above drawing platforms will draw player before, so platforms will be drawn over him. It looks better that way because sometimes angel 'sinks' in the platform with his legs.&lt;br /&gt;&lt;br /&gt;    platforms.forEach(function(platform, index){&lt;br /&gt;        if (platform.isMoving) {&lt;br /&gt;//if platform is able to move&lt;br /&gt;            if (platform.x &lt; 0) {&lt;br /&gt;//and if is on the end of the screen&lt;br /&gt;                platform.direction = 1;&lt;br /&gt;            } else if (platform.x &gt; width - platformWidth) {&lt;br /&gt;                platform.direction = -1;&lt;br /&gt;//switch direction and start moving in the opposite direction&lt;br /&gt;            }&lt;br /&gt;            platform.x += platform.direction * (index / 2) * ~~(points / 100);&lt;br /&gt;//with speed dependent on the index in platforms[] array (to avoid moving all the displayed platforms with the same speed, it looks ugly) and number of points&lt;br /&gt;        }&lt;br /&gt;        platform.draw();&lt;br /&gt;    });&lt;br /&gt;&lt;/pre&gt;Increasing points should be implement in player.checkJump(), after checking if player is in the middle of the screen:&lt;pre name='code' class = 'js'&gt;that.checkJump = function() {&lt;br /&gt;    if (that.Y &gt; height*0.4) {&lt;br /&gt;        that.setPosition(that.X, that.Y - that.jumpSpeed);        &lt;br /&gt;    } else {&lt;br /&gt;        if (that.jumpSpeed &gt; 10) points++; //here!&lt;br /&gt;        MoveCircles(that.jumpSpeed * 0.5);&lt;br /&gt;(...)&lt;br /&gt;&lt;/pre&gt;When everything is already drawn we could render GUI on the top of everything. So add in GameLoop(), just before calling another frame:&lt;pre name='code' class = 'js'&gt;ctx.fillStyle = "Black";&lt;br /&gt;//change active color to black&lt;br /&gt;ctx.fillText("POINTS:" + points, 10, height-10);&lt;br /&gt;//and add text in the left-bottom corner of the canvas&lt;/pre&gt;&lt;span style="font-weight:bold;"&gt;Part 5b. GAME STATES&lt;/span&gt;&lt;br /&gt;Everything works cool, but it is not possible to lose. In case we use &lt;i&gt;setTimeout()&lt;/i&gt; instead of &lt;i&gt;setInterval()&lt;/i&gt;, we need to create boolean variable with game state. It will be 'true' during the game and 'false' when game ends. It is nice to prepare also some GameOver screen. Let's start with adding new variables and modifying &lt;i&gt;GameLoop()&lt;/i&gt;.&lt;pre name='code' class = 'js'&gt;var width = 320, &lt;br /&gt;    height = 500,&lt;br /&gt;    gLoop,&lt;br /&gt;    points = 0,&lt;br /&gt;    state = true,&lt;br /&gt;(...)&lt;br /&gt;&lt;br /&gt;var GameLoop = function(){&lt;br /&gt;(...)&lt;br /&gt;//go to another frame only when state is true&lt;br /&gt;    if (state)&lt;br /&gt;        gLoop = setTimeout(GameLoop, 1000 / 50);&lt;br /&gt;(...)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//GameOver screen&lt;br /&gt;var GameOver = function(){&lt;br /&gt;    state = false;&lt;br /&gt;//set state to false&lt;br /&gt;    clearTimeout(gLoop);&lt;br /&gt;//stop calling another frame&lt;br /&gt;    setTimeout(function(){&lt;br /&gt;//wait for already called frames to be drawn and then clear everything and render text&lt;br /&gt;        clear(); &lt;br /&gt;        ctx.fillStyle = "Black";&lt;br /&gt;        ctx.font = "10pt Arial";&lt;br /&gt;        ctx.fillText("GAME OVER", width / 2 - 60, height / 2 - 50);&lt;br /&gt;        ctx.fillText("YOUR RESULT:" + points, width / 2 - 60, height / 2 - 30);&lt;br /&gt;    }, 100);&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;Now we must determine when to stop the game and display GameOver Screen. We need to modify player's &lt;i&gt;checkfall(&lt;/i&gt;) method&lt;pre name='code' class = 'js'&gt;that.checkFall = function(){&lt;br /&gt;    if (that.Y &lt; height - that.height) {&lt;br /&gt;        that.setPosition(that.X, that.Y + that.fallSpeed);&lt;br /&gt;        that.fallSpeed++;&lt;br /&gt;    } else {&lt;br /&gt;        if (points == 0) &lt;br /&gt;//allow player to step on the floor at he beginning of the game&lt;br /&gt;            that.fallStop();&lt;br /&gt;        else &lt;br /&gt;            GameOver();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;And that's all! Thank you one more time for your time. I'm waiting for questions and ideas of improvement so feel free to ask/write. As usual: - sources on github &lt;a href="http://github.com/michalbe/Simple-game-with-HTML5-Canvas/tree/master//part5/"&gt;Simple game with HTML5 Canvas&lt;/a&gt;- and working example on jsbin: &lt;a href="http://jsbin.com/uharo3"&gt;Simple game with HTML5 Canvas&lt;/a&gt;&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;UPDATE&lt;/b&gt;&lt;br/&gt;I would like to thanks anyone who found my &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Simple HTML5 canvas game tutorial&lt;/a&gt; useful. I receive a lot of emails, tweets, and couple of comments in here with a lot of positive feedback. I know also that some of you tried to create own games based on my tips. Below I put links to games I know about, I hope authors don't mind. If you also have leaned something from my tutorial, and created anything interesting with it, feel free to write me about that, I will put your link here also.&lt;a href="http://www.lutfidemirci.com/"&gt;&lt;img src="http://images.virtualdesign.pl/images/81560g2.jpg"/&gt;&lt;/a&gt; &lt;a href="http://pdfcv.com/game"&gt;&lt;img src="http://images.virtualdesign.pl/images/88960g1.jpg"/&gt;&lt;/a&gt;&lt;a href="http://legendaryjpb.blogspot.com/2011/02/robohunter-html5-demo.html"&gt;&lt;img src="http://images.virtualdesign.pl/images/70892Bez-nazwy-1.png" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-6175965182400217780?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/6175965182400217780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html#comment-form' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6175965182400217780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6175965182400217780'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html' title='Tutorial: Simple game with HTML5 Canvas - part 5'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-5568823140547843971</id><published>2010-09-19T18:55:00.000-07:00</published><updated>2010-09-30T03:38:07.599-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='game mechanics'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='SGWH5'/><title type='text'>Tutorial: Simple game with HTML5 Canvas - part 4</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;&lt;br /&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;&lt;br /&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;&lt;br /&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;&lt;br /&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;&lt;br /&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Part 4a. DRAWING THE PLATFORMS&lt;/span&gt;&lt;br /&gt;There are two types of platforms our character is able to jump on - ordinary one (orange) and green one - trampoline, gives extra speer and hyper-ultra-high jump. There are always seven platforms on the screen at the time (I tried different number, from 4 to 10 and only 7 works fine with screen size I declare at the beginning). Let's create &lt;span style="font-style:italic;"&gt;Platform&lt;/span&gt; "class" (function platforms will inherit from).&lt;pre name='code' class = 'js'&gt;var Platform = function(x, y, type){&lt;br /&gt;//function takes position and platform type&lt;br /&gt;var that=this;&lt;br /&gt;&lt;br /&gt;that.firstColor = '#FF8C00';&lt;br /&gt;that.secondColor = '#EEEE00';&lt;br /&gt;that.onCollide = function(){&lt;br /&gt;player.fallStop();&lt;br /&gt;};&lt;br /&gt;//if platform type is different than 1, set right color &amp; collision function (in this case just call player's fallStop() method we defined last time&lt;br /&gt;if (type === 1) {&lt;br /&gt;//but if type is equal '1', set different color and set jumpSpeed to 50. After such an operation checkJump() method will takes substituted '50' instead of default '17' we set in jump().&lt;br /&gt;that.firstColor = '#AADD00';&lt;br /&gt;that.secondColor = '#698B22';&lt;br /&gt;that.onCollide = function(){&lt;br /&gt;player.fallStop();&lt;br /&gt;player.jumpSpeed = 50;&lt;br /&gt;};&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;that.x = ~~x;&lt;br /&gt;that.y = y;&lt;br /&gt;that.type = type;&lt;br /&gt;&lt;br /&gt;return that;&lt;br /&gt;};&lt;/pre&gt;Now it's necessary to create function which will generate all that platform stuff and put it into &lt;span style="font-style:italic;"&gt;platforms[]&lt;/span&gt; array we will define shortly. After that it will be nice to draw the platforms on the screen.&lt;pre name='code' class = 'js'&gt;var nrOfPlatforms = 7, &lt;br /&gt;platforms = [],&lt;br /&gt;platformWidth = 70,&lt;br /&gt;platformHeight = 20;&lt;br /&gt;//global (so far) variables are not the best place for storing platform size information, but in case it will be needed to calculate collisions I put it here, not as a Platform attributes&lt;br /&gt;var generatePlatforms = function(){&lt;br /&gt;var position = 0, type;&lt;br /&gt;//'position' is Y of the platform, to place it in quite similar intervals it starts from 0&lt;br /&gt;for (var i = 0; i &lt; nrOfPlatforms; i++) {&lt;br /&gt;type = ~~(Math.random()*5);&lt;br /&gt;if (type == 0) type = 1;&lt;br /&gt;else type = 0;&lt;br /&gt;//it's 5 times more possible to get 'ordinary' platform than 'super' one&lt;br /&gt;platforms[i] = new Platform(Math.random()*(width-platformWidth),position,type);&lt;br /&gt;//random X position&lt;br /&gt;if (position &lt; height - platformHeight) &lt;br /&gt;position += ~~(height / nrOfPlatforms);&lt;br /&gt;}&lt;br /&gt;//and Y position interval&lt;br /&gt;}();&lt;br /&gt;//we call that function only once, before game start&lt;/pre&gt;Extending &lt;span style="font-style:italic;"&gt;Platform&lt;/span&gt; object with &lt;span style="font-style:italic;"&gt;draw()&lt;/span&gt; method:&lt;pre name='code' class = 'js'&gt;var Platform = function(x, y, type){&lt;br /&gt;(...)&lt;br /&gt;that.draw = function(){&lt;br /&gt;ctx.fillStyle = 'rgba(255, 255, 255, 1)';&lt;br /&gt;//it's important to change transparency to '1' before drawing the platforms, in other case they acquire last set transparency in Google Chrome Browser, and because circles in background are semi-transparent it's good idea to fix it. I forgot about that in my 10kApart entry, I think because Firefox and Safari change it by default&lt;br /&gt;var gradient = ctx.createRadialGradient(that.x + (platformWidth/2), that.y + (platformHeight/2), 5, that.x + (platformWidth/2), that.y + (platformHeight/2), 45);&lt;br /&gt;gradient.addColorStop(0, that.firstColor);&lt;br /&gt;gradient.addColorStop(1, that.secondColor);&lt;br /&gt;ctx.fillStyle = gradient;&lt;br /&gt;ctx.fillRect(that.x, that.y, platformWidth, platformHeight);&lt;br /&gt;//drawing gradient inside rectangular platform&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;return that;&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;Platform must be drawn on each frame, so updating &lt;span style="font-style:italic;"&gt;GameLoop()&lt;/span&gt; is a must.&lt;pre name='code' class = 'js'&gt;var GameLoop = function(){&lt;br /&gt;(...)&lt;br /&gt;platforms.forEach(function(platform){&lt;br /&gt;platform.draw();&lt;br /&gt;});&lt;br /&gt;(...)&lt;br /&gt;};&lt;/pre&gt;&lt;img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAH0CAYAAABMy/TJAAAgAElEQVR4nO2deX8T173/T2/TNmmbtctN76/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MVKusUngQAB0IwkRVjIiPgkECAAGjNYjj491vEIYVxAgAAYwqCIDHvtHheneVNjsJxN6alAgAAYSl4eKRTHCgsOyGOFaTlSGDYQIAAgs0CAAIDM8v8Bb+t2X3sOX6QAAAAASUVORK5CYII=" width="430"/&gt;&lt;span style="font-weight:bold;"&gt;Part 4b. COLLISIONS&lt;/span&gt;Nice, but there is no interaction between angel and the platforms. But one little function will handle everything. Let me introduce checkCollision():&lt;pre name='code' class = 'js'&gt;var checkCollision = function(){&lt;br /&gt;platforms.forEach(function(e, ind){&lt;br /&gt;//check every plaftorm&lt;br /&gt;if (&lt;br /&gt;(player.isFalling) &amp;&amp; &lt;br /&gt;//only when player is falling&lt;br /&gt;(player.X &lt; e.x + platformWidth) &amp;&amp; &lt;br /&gt;(player.X + player.width &gt; e.x) &amp;&amp; &lt;br /&gt;(player.Y + player.height &gt; e.y) &amp;&amp; &lt;br /&gt;(player.Y + player.height &lt; e.y + platformHeight)&lt;br /&gt;//and is directly over the platform&lt;br /&gt;) {&lt;br /&gt;e.onCollide();&lt;br /&gt;}&lt;br /&gt;})&lt;br /&gt;}&lt;/pre&gt;Another update of main loop (it is good moment to comment line with &lt;span style="font-style:italic;"&gt;MoveCircles()&lt;/span&gt; function - if platforms are standing still why background is falling down? It will makes more sense when we will implement platform scrolling. Whole &lt;span style="font-style:italic;"&gt;GameLoop()&lt;/span&gt; function should looks like that now:&lt;pre name='code' class = 'js'&gt;var GameLoop = function(){&lt;br /&gt;clear();&lt;br /&gt;//MoveCircles(5);&lt;br /&gt;DrawCircles();&lt;br /&gt;&lt;br /&gt;if (player.isJumping) player.checkJump();&lt;br /&gt;if (player.isFalling) player.checkFall();&lt;br /&gt;&lt;br /&gt;platforms.forEach(function(platform){&lt;br /&gt;platform.draw();&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;checkCollision();&lt;br /&gt;&lt;br /&gt;player.draw();&lt;br /&gt;gLoop = setTimeout(GameLoop, 1000 / 50);&lt;br /&gt;}&lt;/pre&gt;Final result: [&lt;a href="http://jsbin.com/igeta3/"&gt;platforms &amp; collisions demo&lt;/a&gt;]Source: [&lt;a href="http://github.com/michalbe/Simple-game-with-HTML5-Canvas/tree/master/part4/"&gt;MichalBe Github&lt;/a&gt;]I think next part will be the last one, but who knows:).&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;&lt;br/&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;&lt;br/&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;&lt;br/&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;&lt;br/&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;&lt;br/&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-5568823140547843971?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/5568823140547843971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5568823140547843971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5568823140547843971'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html' title='Tutorial: Simple game with HTML5 Canvas - part 4'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-5446977065916283958</id><published>2010-09-17T03:51:00.000-07:00</published><updated>2010-09-23T13:47:42.295-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='samsung wave'/><category scheme='http://www.blogger.com/atom/ns#' term='zombie eliminator'/><category scheme='http://www.blogger.com/atom/ns#' term='i18n'/><category scheme='http://www.blogger.com/atom/ns#' term='approval'/><title type='text'>Samsung approval and Thai fonts</title><content type='html'>Is it really impossible for Thai people to read their alphabet when some single gaps will be filled in? Latin alphabet I use every day has evolved through the ages in countless different fonts and shapes, from handwriting, Gothic fonts, print characters, to graffiti. And I'm able to read all of them, just like most people in the world. So why people of Thailand couldn't understand single word when I use custom font with filled gaps? Or maybe that is just another odd invention of Samsung testers? My &lt;a href="http://www.samsungapps.com/topApps/topAppsDetail.as?productId=G00000086939&amp;listYN=Y"&gt;Zombie Eliminator&lt;/a&gt; was removed from Thai Samsung Apps Catalog because, as they said, "Font is not good in Thailand". Why you couldn't understand this ('original' word above, and red mark on the screenshot made by Samsung Content Inspector):&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/83349thai.png" width="430" /&gt;...when Latin alphabet is totally understandable for me and rest of the world, even with filled gaps (like 'o' or 'p'):&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/69425Bez-nazwy-2.jpg" width="430" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-5446977065916283958?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/5446977065916283958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/09/samsung-approval-and-thai-fonts.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5446977065916283958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5446977065916283958'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/09/samsung-approval-and-thai-fonts.html' title='Samsung approval and Thai fonts'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-135944718988761280</id><published>2010-09-16T09:56:00.001-07:00</published><updated>2010-09-30T03:37:42.830-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='game mechanics'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='SGWH5'/><title type='text'>Tutorial: Simple game with HTML5 Canvas - part 3</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;&lt;br /&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;&lt;br /&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;&lt;br /&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;&lt;br /&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;&lt;br /&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Part 3a. PHYSICS&lt;/span&gt;&lt;br /&gt;&lt;img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAH0CAYAAABMy/TJAAAgAElEQVR4nO3dWXbbRqKAYe0gC7jZS1aRjXS/9g7ylL3cfVyOoiZKlmQHAClOjjvnkNQ5dR/AsiEYM6pQ0//wnXbHstqxrL9rQuFqFB0FgHrj+CiW27N42uFpdxbP+7P4/PXdaVem/1IBLpnGR/FIBMXT7iw+H8wHjAACA5snJ+PxMe3Fg9EfAQQ6ulmHG8FPOz/iRwCBHu7ewozgy4EAAoiO4n4TVgR9Gv0RQKCncXwUy435MA02+vNk7Y8AAoqEFEEfdn4JIKDYJIAzgj6c+8v6QgABdSaenxF89WT099fXd5F8exer/xJAQClfR4K+bH58+fouVpf4EUBAg3F8FA+erQn6svnx19cf8SOAgCa+RdCXzQ8CCAzIh8PSnzwZ/UkJU2BgOLeOPzbn4+5v/C1dCySAwADmq5N4cnRz5NWjR9/yCCAwkKmjO8SmI0UAAU+MY7eeH/Zt/Y8AAha4dmRK7Nv6HwEELDFx4KiMT1dfEUDAMuPI7stVfXn8jQACFptYujboywHoQgcCCFhlsTpZdaGC8Uhp8rw/i7u3EwEEbGPLtNjHHeDX/bu435zFzfokbtYEELDW1P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ptFTFlLTufys7DTf95wKo4HwAfRz1SW02JlRMh6umwNmXqJv+cwFUcTaAPo/6RtGx9BCyzqlp0VMfhA8+cy6AE89HfVlN1+RUjQBHUbt3FgOucyqArh9qbqtqCpwfpZn+vQIuciKAoYUvq+qKK9XHYIDQWB1A39f5mspPRfN3AJr+/QGusi6AIa3xATDLmgASPgBDMx7A+eooFquTuFmfxN1b6nZ9Eov1ScySE1NgANoMH8DkKG7fTuJxexbP+7N4aeBpexa3bycxTcz/gQHwxyABnMRHMUuO4mFzahS8KsvtWcySk/E/OADu0xLASWZNbxKlI76+4fsphJtz0MdjAPTXO4DZ2OXX66bJUTzt1IYv63l/FtcrRoMAurmaVEQtb5wJXd3mxDw5NV7j6+v2jQgCaO9Kxye9Xqmf8ta5J4IAWlIewFkyfPwYCQLoQmkAJ/FxsGlvGdYEATSlNIDLrdn4vezTjRF2hwE0oSyACwPrfmUeNmfjf7AA7KcsgJ80HnfpYsZTIwBqKAmgTaM/RoEAmlISwEcL1v6KsBYIoErvAE7jo/HQlblZsyMMoFzvAN6s7Zv+Ssst02AA5XoH8GFjPnRlnvcEEEC53gHUedmBClPWAQGU6B1A04GrM+fJEAAlegVwbPEGiMSjcQDK9ArgxIEALtgJBlDC+xHgghEggBL9AhjZH0CmwADK9N4Ese0Z4DyeCQZQpncAbX0MTuK9wgDK9A7gnYY3vqnytOMgNIBy/w8mTHpnOFZj3QAAAABJRU5ErkJggg==" width=100 style="margin:5px;float:right"/&gt;Because physics in StH is very simple, there is no need to include any Physics Engine such as &lt;a href="http://box2d-js.sourceforge.net/"&gt;Box2d&lt;/a&gt;. Jumping is so uncomplicated that it is possible to implement it just in few code lines.&lt;br /&gt;Let's divide it into two unrelated parts - jumping and falling. When object start to jump, it has some initial velocity, deceased by gravity. It phase ends when that velocity is completely reduced and gravity starts to attract object down with increasing force. That is the second part of the jump - falling. To teach angel how to behave in such situations, let's expand &lt;span style="font-style:italic;"&gt;player&lt;/span&gt; object with few more attributes:&lt;pre name='code' class = 'js'&gt;var player = new (function(){&lt;br /&gt;var that = this;&lt;br /&gt;that.image = new Image();&lt;br /&gt;(...)&lt;br /&gt;&lt;br /&gt;//new attributes&lt;br /&gt;that.isJumping = false;&lt;br /&gt;that.isFalling = false;&lt;br /&gt;//state of the object described by bool variables - is it rising or falling?&lt;br /&gt;&lt;br /&gt;that.jumpSpeed = 0;&lt;br /&gt;that.fallSpeed = 0;&lt;br /&gt;//each - jumping &amp; falling should have its speed values&lt;br /&gt;&lt;br /&gt;(...) //rest of the code&lt;br /&gt;})();&lt;/pre&gt;Now lets introduce methods responsible for jumping. Further expanding of &lt;span style="font-style:italic;"&gt;player&lt;/span&gt; object:&lt;pre name='code' class = 'js'&gt;that.jump = function() {&lt;br /&gt;//initiation of the jump&lt;br /&gt;if (!that.isJumping &amp;&amp; !that.isFalling) {&lt;br /&gt;//if objects isn't currently jumping or falling (preventing of 'double jumps', or bouncing from the air&lt;br /&gt;that.fallSpeed = 0;&lt;br /&gt;that.isJumping = true;&lt;br /&gt;that.jumpSpeed = 17;&lt;br /&gt;// initial velocity&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;that.checkJump = function() {&lt;br /&gt;//when 'jumping' action was initiated by jump() method, initiative is taken by this one.&lt;br /&gt;that.setPosition(that.X, that.Y - that.jumpSpeed);&lt;br /&gt;//move object by number of pixels equal to current value of 'jumpSpeed'&lt;br /&gt;that.jumpSpeed--;&lt;br /&gt;//and decease it (simulation of gravity)&lt;br /&gt;if (that.jumpSpeed == 0) {&lt;br /&gt;//start to falling, similar to jump() function&lt;br /&gt;that.isJumping = false;&lt;br /&gt;that.isFalling = true;&lt;br /&gt;that.fallSpeed = 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;that.checkFall = function(){&lt;br /&gt;//same situation as in checkJump()&lt;br /&gt;if (that.Y &lt; height - that.height) {&lt;br /&gt;//check if the object meets the bottom of the screen, if not just change the position and increase fallSpeed (simulation of gravity acceleration)...&lt;br /&gt;that.setPosition(that.X, that.Y + that.fallSpeed);&lt;br /&gt;that.fallSpeed++;&lt;br /&gt;} else {&lt;br /&gt;//..if yes - bounce&lt;br /&gt;that.fallStop();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;that.fallStop = function(){&lt;br /&gt;//stop falling, start jumping again&lt;br /&gt;that.isFalling = false;&lt;br /&gt;that.fallSpeed = 0;&lt;br /&gt;that.jump();    &lt;br /&gt;}&lt;/pre&gt;It's necessarily to update main loop function to redraw player's position while jumping and falling. Update&lt;span style="font-style:italic;"&gt; GameLoop()&lt;/span&gt; with this code, just before drawing the character:&lt;pre name='code' class = 'js'&gt;if (player.isJumping) player.checkJump();&lt;br /&gt;if (player.isFalling) player.checkFall();&lt;/pre&gt;I think above code is clear enough to understand. Last action we have to take with all that physics stuff is simply initiation of the first jump, right after placing &lt;span style="font-style:italic;"&gt;player&lt;/span&gt; on the stage.&lt;pre name='code' class = 'js'&gt;player.setPosition(~~((width-player.width)/2), ~~((height - player.height)/2));&lt;br /&gt;player.jump(); //here&lt;/pre&gt;Ok, it's jumping beautifully, piece of awesome pseudo-physics code. Now let's make some controls. &lt;span style="font-weight:bold;"&gt;Part 3b. CONTROLLS&lt;/span&gt;Main character of &lt;span style="font-weight:bold;"&gt;StH&lt;/span&gt; can move sideways only. It jumps automatically, up/down movement depends of platforms. User can only command angel to move left or right. One more time it could be achieved by with extension &lt;span style="font-style:italic;"&gt;player&lt;/span&gt; object with additional methods.&lt;pre name='code' class = 'js'&gt;var player = new(function(){&lt;br /&gt;(...)&lt;br /&gt;that.moveLeft = function(){&lt;br /&gt;if (that.X &gt; 0) {&lt;br /&gt;//check whether the object is inside the screen&lt;br /&gt;that.setPosition(that.X - 5, that.Y);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;that.moveRight = function(){&lt;br /&gt;if (that.X + that.width &lt; width) {&lt;br /&gt;//check whether the object is inside the screen&lt;br /&gt;that.setPosition(that.X + 5, that.Y);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;(...)&lt;br /&gt;})();&lt;/pre&gt;Now bind that functions to the mouse pointer position (angel will follow it).&lt;pre name='code' class = 'js'&gt;document.onmousemove = function(e){&lt;br /&gt;if (player.X + c.offsetLeft &gt; e.pageX) {&lt;br /&gt;//if mouse is on the left side of the player.&lt;br /&gt;player.moveLeft();&lt;br /&gt;} else if (player.X + c.offsetLeft &lt; e.pageX) {&lt;br /&gt;//or on right?&lt;br /&gt;player.moveRight();&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;It's everything for today. In next episode I will introduce platform drawing and collisions. As usual:[&lt;a href="http://jsbin.com/uhaka3/"&gt;demo with jumping &amp; controls&lt;/a&gt;] [&lt;a href="http://github.com/michalbe/Simple-game-with-HTML5-Canvas/tree/master/part3/"&gt;source in GitHub repo&lt;/a&gt;]&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;&lt;br/&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;&lt;br/&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;&lt;br/&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;&lt;br/&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;&lt;br/&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-135944718988761280?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/135944718988761280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/135944718988761280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/135944718988761280'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html' title='Tutorial: Simple game with HTML5 Canvas - part 3'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-28571914882221519</id><published>2010-09-11T15:07:00.000-07:00</published><updated>2011-04-13T05:37:54.968-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='game mechanics'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='SGWH5'/><title type='text'>Tutorial: Simple game with HTML5 Canvas - part 2</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;&lt;br /&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;&lt;br /&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;&lt;br /&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;&lt;br /&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;&lt;br /&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Part 2. CHARACTER&lt;/span&gt;&lt;br /&gt;It is time now to add main character to the awesome background created in &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;the last part&lt;/a&gt;. In &lt;span style="font-weight:bold;"&gt;StH&lt;/span&gt; it was cute little angel with simple wing flapping animation in just two frames, saved in .png with transparent background. Exactly like this one:&lt;center&gt;&lt;img src="http://images.virtualdesign.pl/images/99444maluszek.png"&gt;&lt;/center&gt;Let's create object representing main character with all necessarily methods and attributes. I will call it '&lt;span style="font-style:italic;"&gt;player&lt;/span&gt;'. The way of creating objects I present here is not the best one, all the attributes are visible from outside the object, there is no privacy at all. But that was simplest and shortest solution I was able to implement to fit 10KB, and most importantly - it works. If you want to know how to define proper objects with private attributes, inheritance, etc. read about &lt;a href="http://jibbering.com/faq/notes/closures/"&gt;Javascript Closures&lt;/a&gt;. Also it's important to remember, when you want to shrink your code with tools like &lt;a href="http://closure-compiler.appspot.com/home"&gt;Closure Compiler&lt;/a&gt;, that names of object's arguments won't change. That why in original code I use 2 letters shortcuts for describing &lt;span style="font-style:italic;"&gt;player&lt;/span&gt; object, like '&lt;span style="font-style:italic;"&gt;player.im&lt;/span&gt;' instead of '&lt;span style="font-style:italic;"&gt;player.image&lt;/span&gt;', etc. SO, the object:&lt;pre name='code' class = 'js'&gt;var player = new (function(){&lt;br /&gt;//create new object based on function and assign &lt;br /&gt;//what it returns to the 'player' variable&lt;br /&gt;&lt;br /&gt;    var that = this;&lt;br /&gt;//'that' will be the context now&lt;br /&gt;&lt;br /&gt;//attributes&lt;br /&gt;    that.image = new Image();&lt;br /&gt;    that.image.src = "angel.png";&lt;br /&gt;//create new Image and set it's source to the &lt;br /&gt;//'angel.png' image I upload above&lt;br /&gt;&lt;br /&gt;    that.width = 65;&lt;br /&gt;//width of the single frame&lt;br /&gt;    that.height = 95;&lt;br /&gt;//height of the single frame&lt;br /&gt;&lt;br /&gt;    that.X = 0;&lt;br /&gt;    that.Y = 0;&lt;br /&gt;//X&amp;Y position&lt;br /&gt;&lt;br /&gt;//methods &lt;br /&gt;    that.setPosition = function(x, y){&lt;br /&gt;    that.X = x;&lt;br /&gt;    that.Y = y;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;    that.draw = function(){&lt;br /&gt;        try {&lt;br /&gt;            ctx.drawImage(that.image, 0, 0, that.width, that.height, that.X, that.Y, that.width, that.height);&lt;br /&gt;//cutting source image and pasting it into destination one, drawImage(Image Object, source X, source Y, source Width, source Height, destination X (X position), destination Y (Y position), Destination width, Destination height)&lt;br /&gt;        } catch (e) {&lt;br /&gt;//sometimes, if character's image is too big and will not load until the drawing of the first frame, Javascript will throws error and stop executing everything. To avoid this we have to catch an error and retry painting in another frame. It is invisible for the user with 50 frames per second.&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;})();&lt;br /&gt;//we immediately execute the function above and &lt;br /&gt;//assign its result to the 'player' variable&lt;br /&gt;//as a new object &lt;br /&gt;&lt;br /&gt;player.setPosition(~~((width-player.width)/2),  ~~((height - player.height)/2));&lt;br /&gt;//our character is ready, let's move it &lt;br /&gt;//to the center of the screen,&lt;br /&gt;//'~~' returns nearest lower integer from&lt;br /&gt;//given float, equivalent of Math.floor()&lt;/pre&gt;Ok, so now the angel needs to be redrawn on each frame. &lt;span style="font-style:italic;"&gt;GameLoop()&lt;/span&gt; will be updated with &lt;span style="font-style:italic;"&gt;player.draw()&lt;/span&gt; function:&lt;pre name='code' class = 'js'&gt;var GameLoop = function(){&lt;br /&gt;    clear();&lt;br /&gt;    MoveCircles(5);&lt;br /&gt;    DrawCircles();&lt;br /&gt;    player.draw();&lt;br /&gt;    gLoop = setTimeout(GameLoop, 1000 / 50);&lt;br /&gt;}&lt;/pre&gt;But what about animation? Angel sprite has 2 frames, but only one is redrawn on each frame. To make an animation, our &lt;span style="font-style:italic;"&gt;player&lt;/span&gt; needs additional attributes and a little changes in &lt;span style="font-style:italic;"&gt;draw()&lt;/span&gt; method.&lt;pre name='code' class = 'js'&gt;var player = new (function(){&lt;br /&gt;(...)&lt;br /&gt;    that.frames = 1;&lt;br /&gt;//number of frames indexed from zero&lt;br /&gt;    that.actualFrame = 0;&lt;br /&gt;//start from which frame&lt;br /&gt;    that.interval = 0;&lt;br /&gt;//we don't need to switch animation frame&lt;br /&gt;//on each game loop, interval will helps&lt;br /&gt;//with this.&lt;br /&gt;&lt;br /&gt;    that.draw = function(){&lt;br /&gt;        try {&lt;br /&gt;            ctx.drawImage(that.image, 0, that.height * that.actualFrame, that.width, that.height, that.X, that.Y, that.width, that.height);&lt;br /&gt;//3rd agument needs to be multiplied by number of frames, so on each loop different frame will be cut from the source image&lt;br /&gt;        } catch (e) {};&lt;br /&gt;&lt;br /&gt;        if (that.interval == 4 ) {&lt;br /&gt;            if (that.actualFrame == that.frames) {&lt;br /&gt;                that.actualFrame = 0;&lt;br /&gt;            } else {&lt;br /&gt;                that.actualFrame++;&lt;br /&gt;            }&lt;br /&gt;            that.interval = 0;&lt;br /&gt;        }&lt;br /&gt;    that.interval++;&lt;br /&gt;//all that logic above just&lt;br /&gt;//switch frames every 4 loops  &lt;br /&gt;    }&lt;br /&gt;})();&lt;/pre&gt;Thanks for your attention. As usual, you can find final result in here: [&lt;a href="http://jsbin.com/orohe4/"&gt;Simple game with HTML5 Canvas&lt;/a&gt;] and all the sources on my Github account: [&lt;a href="http://github.com/michalbe/Simple-game-with-HTML5-Canvas/tree/master/part2/"&gt;MichalBe&lt;/a&gt;].&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;&lt;br /&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;&lt;br /&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;&lt;br /&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;&lt;br /&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;&lt;br /&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-28571914882221519?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/28571914882221519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/28571914882221519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/28571914882221519'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html' title='Tutorial: Simple game with HTML5 Canvas - part 2'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-5965514530854143580</id><published>2010-09-10T18:19:00.000-07:00</published><updated>2011-10-27T14:27:06.207-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='game mechanics'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='SGWH5'/><title type='text'>Tutorial: Simple game with HTML5 Canvas - part 1</title><content type='html'>Check other language versions: &lt;a href="http://aismnw.blogspot.com/2011/10/html5-canvas-1.html"&gt;[RUSSIAN]&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;&lt;br /&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;&lt;br /&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;&lt;br /&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;&lt;br /&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;&lt;br /&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you are interested in news and updates of that tutorial just follow me on twitter: [&lt;a href="http://twitter.com/michalbe"&gt;MichalBe's Twitter&lt;/a&gt;]&lt;br /&gt;&lt;br /&gt;Because &lt;a href="http://10k.aneventapart.com/"&gt;10KApart&lt;/a&gt; is closed now, and we are all waiting for the results, it is good time to remind my very simple "&lt;a href="http://10k.aneventapart.com/Entry/36"&gt;Stairs to heaven&lt;/a&gt;" game and explain in details how it was made. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;INTRODUCTION&lt;/span&gt;&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/87852sth.png" width="120" style="float:left;margin:5px;"/&gt;&lt;span style="font-weight:bold;"&gt;StH&lt;/span&gt; is very simple clone of &lt;a href="http://en.wikipedia.org/wiki/Doodle_Jump"&gt;Doodle Jump&lt;/a&gt;, but to be honest I was inspired by &lt;a href="http://en.wikipedia.org/wiki/Icy_Tower"&gt;Icy Tower&lt;/a&gt; and discover DJ after I submit StH to the competition. Never mind.&lt;br /&gt;The goal is to control little angel &amp; jump on the two kinds of platforms - orange (regular ones) and green (super high jump springboards). The game ends when the angel falls down to the bottom of the screen. Try it: [&lt;a href="http://10k.aneventapart.com/Entry/36"&gt;Stairs to heaven&lt;/a&gt;].&lt;br /&gt;I create that game in about 8hours and later, after playing more and more, I discover few bugs so in this tutorial I want to fix it all. Let's do it!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Part 1. BACKGROUND&lt;/span&gt;&lt;br /&gt;Because whole game, including images and scripts,  couldn't be over 10K, I didn't want to use image on the background. It was cheaper to draw some generic-like stuff using &lt;span style="font-weight:bold;"&gt;canvas&lt;/span&gt; drawing functions.&lt;br /&gt;First of all we need little HTML, nothing special, just one canvas element with some unique id, little bit of CSS and include of not existing yet game.js:&lt;pre name='code' class = 'js'&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;Simple game with HTML5 Canvas&amp;lt;/title&amp;gt;&lt;br /&gt;  &amp;lt;style&amp;gt;&lt;br /&gt;  body {&lt;br /&gt;    margin:0px;&lt;br /&gt;    padding:0px;&lt;br /&gt;    text-align:center;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  canvas{&lt;br /&gt;    outline:0;&lt;br /&gt;    border:1px solid #000;&lt;br /&gt;    margin-left: auto;&lt;br /&gt;    margin-right: auto;&lt;br /&gt;  }&lt;br /&gt;  &amp;lt;/style&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;canvas id='c'&amp;gt;&amp;lt;/canvas&amp;gt;&lt;br /&gt;    &amp;lt;script src=&amp;quot;game.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;That's all in HTML we will need during this tutorial.&lt;br /&gt;Ok, so let's create some Javascript.&lt;br /&gt;First of all we need to create few global (for now, I know that global = evil) variables &amp; change canvas attributes. That will be enough:&lt;pre name='code' class = 'js'&gt;var width = 320,&lt;br /&gt;//width of the canvas&lt;br /&gt;  height = 500,&lt;br /&gt;//height of the canvas&lt;br /&gt;&lt;br /&gt;  c = document.getElementById('c'), &lt;br /&gt;//canvas itself &lt;br /&gt;&lt;br /&gt;  ctx = c.getContext('2d');&lt;br /&gt;//and two-dimensional graphic context of the&lt;br /&gt;//canvas, the only one supported by all &lt;br /&gt;//browsers for now&lt;br /&gt;&lt;br /&gt;c.width = width;&lt;br /&gt;c.height = height;&lt;br /&gt;//setting canvas size &lt;/pre&gt;First of all its important to understand one thing about canvas - it is &lt;span style="font-weight:bold;"&gt;not&lt;/span&gt; possible to move objects in the canvas surface. It's necessarily to clear it, whole or in the parts, on each frame. To achieve this, let's create &lt;span style="font-weight:bold;"&gt;clear()&lt;/span&gt; function. &lt;pre name='code' class = 'js'&gt;var clear = function(){&lt;br /&gt;  ctx.fillStyle = '#d0e7f9';&lt;br /&gt;//set active color to #d0e... (nice blue)&lt;br /&gt;//UPDATE - as 'Ped7g' noticed - using clearRect() in here is useless, we cover whole surface of the canvas with blue rectangle two lines below. I just forget to remove that line&lt;br /&gt;//ctx.clearRect(0, 0, width, height);&lt;br /&gt;//clear whole surface&lt;br /&gt;  ctx.beginPath();&lt;br /&gt;//start drawing&lt;br /&gt;  ctx.rect(0, 0, width, height);&lt;br /&gt;//draw rectangle from point (0, 0) to&lt;br /&gt;//(width, height) covering whole canvas&lt;br /&gt;  ctx.closePath();&lt;br /&gt;//end drawing&lt;br /&gt;  ctx.fill();&lt;br /&gt;//fill rectangle with active&lt;br /&gt;//color selected before&lt;br /&gt;}&lt;/pre&gt;One colored clear background is boring as hell, so let's draw some clouds on it. Maybe not regular clouds, but simple, semitransparent circles imitating clouds. First we will draw some in random places of the canvas, each with different size and transparency. We will keep all the informations about circles in 2d array (there are no two-dimensional arrays in JS, best way to solve this is just put one Array into another). &lt;pre name='code' class = 'js'&gt;var howManyCircles = 10, circles = [];&lt;br /&gt;&lt;br /&gt;for (var i = 0; i &lt; howManyCircles; i++) &lt;br /&gt;  circles.push([Math.random() * width, Math.random() * height, Math.random() * 100, Math.random() / 2]);&lt;br /&gt;//add information about circles into&lt;br /&gt;//the 'circles' Array. It is x &amp; y positions, &lt;br /&gt;//radius from 0-100 and transparency &lt;br /&gt;//from 0-0.5 (0 is invisible, 1 no transparency)&lt;br /&gt;&lt;br /&gt;var DrawCircles = function(){&lt;br /&gt;  for (var i = 0; i &lt; howManyCircles; i++) {&lt;br /&gt;    ctx.fillStyle = 'rgba(255, 255, 255, ' + circles[i][3] + ')';&lt;br /&gt;//white color with transparency in rgba&lt;br /&gt;    ctx.beginPath();&lt;br /&gt;    ctx.arc(circles[i][0], circles[i][1], circles[i][2], 0, Math.PI * 2, true);&lt;br /&gt;//arc(x, y, radius, startAngle, endAngle, anticlockwise)&lt;br /&gt;//circle has always PI*2 end angle&lt;br /&gt;    ctx.closePath();&lt;br /&gt;    ctx.fill();&lt;br /&gt;  }&lt;br /&gt;};&lt;/pre&gt;Nice, but boring less only a little. Why are the clouds standing still? Lets make a tiny little function with one Number type argument, which moves clouds down given number of pixels, and when particular circle disappears under the canvas, it will moves it on the top with changed position X, radius and transparency:&lt;pre name='code' class = 'js'&gt;var MoveCircles = function(deltaY){&lt;br /&gt;  for (var i = 0; i &lt; howManyCircles; i++) {&lt;br /&gt;    if (circles[i][1] - circles[i][2] &gt; height) {&lt;br /&gt;//the circle is under the screen so we change&lt;br /&gt;//informations about it &lt;br /&gt;      circles[i][0] = Math.random() * width;&lt;br /&gt;      circles[i][2] = Math.random() * 100;&lt;br /&gt;      circles[i][1] = 0 - circles[i][2];&lt;br /&gt;      circles[i][3] = Math.random() / 2;&lt;br /&gt;    } else {&lt;br /&gt;//move circle deltaY pixels down&lt;br /&gt;      circles[i][1] += deltaY;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;};&lt;/pre&gt;Now, last but not least, let's create main game loop and connect everything we create for now in there. Each frame will clear the screen, move circles 5px lower, draw them and after 1/50sec call another frame. I use two setTimeouts except one setInterval, but I'm not pretty sure why:). I know that there was some performance issues in IE back in the days or something.Also don't forget to add &lt;span style="font-style:italic;"&gt;gLoop&lt;/span&gt; variable to that declared at the beginning.&lt;pre name='code' class = 'js'&gt;var width = 320,  &lt;br /&gt;//width of the canvas  &lt;br /&gt;  height = 500,  &lt;br /&gt;//height of the canvas  &lt;br /&gt;  gLoop,&lt;br /&gt;(...) //rest of the code goes here&lt;br /&gt;&lt;br /&gt;var GameLoop = function(){&lt;br /&gt;  clear();&lt;br /&gt;  MoveCircles(5);&lt;br /&gt;  DrawCircles();&lt;br /&gt;  gLoop = setTimeout(GameLoop, 1000 / 50);&lt;br /&gt;}&lt;br /&gt;GameLoop();&lt;/pre&gt;According to Luis Giribone's comment below, I avoid Intervals and use Timeouts instead intentionally - Interval is called every 1000/fps seconds - even if the previous one disn't not finished yet. If you use Timeout, it will call another one only after previous was finished. I hope it is clear now.I also want to thanks Ped7g, author of &lt;a href="http://www.naplntemisky.cz/hra/"&gt;Whiskas &amp; Pedigree&lt;/a&gt; Javascript ad game for catching mistakes.Final result of that part should looks like this: [&lt;a href="http://jsbin.com/odoho3"&gt;Simple game with HTML5 Canvas part 1&lt;/a&gt;], and sources are available on my Github account: [&lt;a href="http://github.com/michalbe/Simple-game-with-HTML5-Canvas"&gt;MichalBe&lt;/a&gt;]&lt;span style="font-weight:bold;"&gt;Tutorial: Simple game with HTML5 Canvas&lt;/span&gt;Part 1 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html"&gt;Introduction &amp; Background&lt;/a&gt;Part 2 - &lt;a href="http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-2.html"&gt;Character &amp; Animation&lt;/a&gt;Part 3 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas.html"&gt;Physics &amp; Controls&lt;/a&gt;Part 4 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_19.html"&gt;Platforms &amp; Collisions&lt;/a&gt;Part 5 - &lt;a href="http://michalbe.blogspot.com/2010/09/tutorial-simple-game-with-html5-canvas_30.html"&gt;Scrolling &amp; Game States&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-5965514530854143580?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/5965514530854143580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html#comment-form' title='33 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5965514530854143580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5965514530854143580'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/09/simple-game-with-html5-canvas-part-1.html' title='Tutorial: Simple game with HTML5 Canvas - part 1'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>33</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-908481559517209123</id><published>2010-09-04T20:32:00.000-07:00</published><updated>2010-09-06T04:36:05.320-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='selling'/><category scheme='http://www.blogger.com/atom/ns#' term='samsung wave'/><category scheme='http://www.blogger.com/atom/ns#' term='zombie eliminator'/><category scheme='http://www.blogger.com/atom/ns#' term='palm'/><category scheme='http://www.blogger.com/atom/ns#' term='bada'/><category scheme='http://www.blogger.com/atom/ns#' term='publishing'/><category scheme='http://www.blogger.com/atom/ns#' term='palm app catalog'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='zombies'/><title type='text'>Zombie Eliminator &amp; Real Decision Ball on bada</title><content type='html'>My Zombie Eliminator (first mobile game &lt;a href="http://michalbe.blogspot.com/2010/07/i18n-in-javascript-apps.html"&gt;in 16 languages&lt;/a&gt;, available on &lt;a href="http://developer.palm.com/appredirect/?packageid=zombie-eliminator"&gt;Palm Pre &amp; Pixi&lt;/a&gt;, &lt;a href="http://www.appbrain.com/app/zombie.eliminator"&gt;Android&lt;/a&gt; &amp; &lt;a href="http://www.samsungapps.com/topApps/topAppsDetail.as?productId=G00000086939&amp;listYN=Y"&gt;Samsung bada&lt;/a&gt;) was today on place &lt;span style="font-weight:bold;"&gt;20.&lt;/span&gt; (out of near 1800) in 'top 50 paid apps' in Chinese Samsung Apps Store, &lt;span style="font-weight:bold;"&gt;32.&lt;/span&gt; in Italian &amp; Mexican, &lt;span style="font-weight:bold;"&gt;44.&lt;/span&gt; in Australian and &lt;span style="font-weight:bold;"&gt;46.&lt;/span&gt; in Turkish. I feel  gently honored:).&lt;br /&gt;&lt;a href="http://images.virtualdesign.pl/images/56078ze.jpg" target=_blank&gt;&lt;img src="http://images.virtualdesign.pl/images/56078ze.jpg" width=430 /&gt;&lt;/a&gt;&lt;br /&gt;And my other App, Real Decision Ball (also on &lt;a href="http://developer.palm.com/appredirect/?packageid=real.decisionball"&gt;Palm Pre &amp; Pixi&lt;/a&gt;, &lt;a href="http://www.appbrain.com/app/real.decisionball"&gt;Android&lt;/a&gt; &amp; &lt;a href="http://www.samsungapps.com/topApps/topAppsDetail.as?productId=G00000087609&amp;listYN=Y"&gt;Samsung bada&lt;/a&gt;) is now number 3 in Mexican Market.&lt;a href="http://images.virtualdesign.pl/images/98639mex.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/98639mex.jpg" width=430 /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-908481559517209123?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/908481559517209123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/09/zombie-eliminator-bada.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/908481559517209123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/908481559517209123'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/09/zombie-eliminator-bada.html' title='Zombie Eliminator &amp; Real Decision Ball on bada'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-5328198650839764541</id><published>2010-08-31T13:21:00.000-07:00</published><updated>2010-09-04T08:06:58.994-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='node.js'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='nodeKO'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>NodeKnockout - Massivetris</title><content type='html'>Try my first &lt;a href="http://nodejs.org/"&gt;node.js&lt;/a&gt; app ever - created in 48h Massive Multiplayer Online Tetris. Choose from one of 72 avatars and play with others in realtime. It works best in Safari or Chrome, in Firefox WebSockets are emulated by Flash Plugin (awesome &lt;a href="http://github.com/LearnBoost/Socket.IO"&gt;Socket.IO&lt;/a&gt; feature). There are couple of bugs I'm aware of, but it is possible to play and have some fun. If you enjoyed, don't forget to vote (button in right-top corner). &lt;br /&gt;Direct links to the game: [&lt;a href="http://virtual-design.no.de/"&gt;Massivetris&lt;/a&gt;] and to the [&lt;a href="http://nodeknockout.com/teams/virtual-design"&gt;Team Site&lt;/a&gt;].&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;iframe src="http://player.vimeo.com/video/14530072" width="430" height="265" frameborder="0"&gt;&lt;/iframe&gt;&lt;/center&gt;And here is the source: &lt;a href="http://github.com/nko/virtual-design"&gt;[Massivetris]&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-5328198650839764541?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/5328198650839764541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/08/nodeknockout-massivetris.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5328198650839764541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5328198650839764541'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/08/nodeknockout-massivetris.html' title='NodeKnockout - Massivetris'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-1816833442278854525</id><published>2010-08-27T17:07:00.000-07:00</published><updated>2010-08-29T13:22:50.143-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='node.js'/><category scheme='http://www.blogger.com/atom/ns#' term='nodeKO'/><title type='text'>NodeKnockout timeline</title><content type='html'>&lt;span style="font-weight:bold;"&gt;VirtualDesign team &lt;/span&gt;represented by single person of MichalBe.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;02:03 CET&lt;/span&gt;&lt;br /&gt;Ok, everything starts. I want to make some socket based experiments so unfortunately i have to deploy my project to &lt;a href="http://no.de"&gt;Joyent&lt;/a&gt;, instead of &lt;a href="http://heroku.com"&gt;Heroku&lt;/a&gt; (which I found much easier to use).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;02:11 CET&lt;/span&gt;&lt;br /&gt;I already create few aliases for faster pushing my files to both, github repo and Joyent. You can check my activity on &lt;a href="http://leaderboard.no.de/"&gt;Node Leaderboard&lt;/a&gt;, little 'virtual-design' dot somewhere in central europe.&lt;a href="http://images.virtualdesign.pl/images/66245node.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/66245node.jpg" width=430/&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;02:32 CET&lt;/span&gt;&lt;br /&gt;Serving static files from server is working fine now, based on &lt;a href="http://github.com/LearnBoost/Socket.IO-node"&gt;Socket.IO-node&lt;/a&gt; examples.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;03:01 CET&lt;/span&gt;&lt;br /&gt;We survived first hour without unexpected accidents. I've never worked with Joyent before, and in project like that is important to fully understand environment you're working on. That's why I'm testing everything before implementation.&lt;a href="http://images.virtualdesign.pl/images/879421st.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/879421st.jpg" width=430/&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="0320"&gt;03:20 CET&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;First little pizza-break. By the way, did I mention that I love Tabasco?&lt;img src="http://images.virtualdesign.pl/images/490372nd.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="0558"&gt;05:58 CET&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;Through the window on my wall I can see first rays of the morning sun, and through that one on my desk I see first excellent working socket connection game prototype. Well, almost excellent. I have no idea why Safari behaves so weird.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="0622"&gt;06:22 CET&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;Ok, now it works great everywhere. I had strange feelings about Firefox sockets, but I hope it is just my eternal flash aversion and everything will be fine.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="0737"&gt;07:37 CET&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;According to the Leaderboard, virtual-design team is 5th in deployment size and numbers of deploys. &lt;a href="http://images.virtualdesign.pl/images/923483rd.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/923483rd.jpg" width=430 /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="0848"&gt;08:48 CET&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;I'm seriously sleepy now, one and only thing that gives me big energy shot for now is progress of my game - for now my &lt;span style="font-weight:bold;"&gt;Massive Multi-player Tetris&lt;/span&gt; is able to generate blocks (of course on the server side) for one user and send it using sockets. Next I will make a ToDo list, I suppose it could be helpful.&lt;a href="http://images.virtualdesign.pl/images/596294rd.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/596294rd.jpg" width=430 /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="2346"&gt;23:46 CET&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;Since last update I finish main game mechanics and sleep a little. I plan finish everything with code tonight, and spend the whole day tomorrow to create graphics etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="0831d2"&gt;08:31 CET, DAY 2&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;All the logic is now on the server side, client just send the orders (keyboard input) and render game-board sent by the server. I'm excited, everything works brilliant. Now I have to create better look for it, coz table with one-color filled fields is boring as hell (4 players in the game, each has different color):&lt;img src="http://images.virtualdesign.pl/images/911725th.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="0937d2"&gt;09:37 CET, DAY 2&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;Uh, I'm not web designer though I know a few Photoshop tricks, I hope that will be enough. That's why I plan to spend whole day on the visual aspects of my game. What do you think about the name "&lt;span style="font-weight:bold;"&gt;Massivetris&lt;/span&gt;", like MMO tetris?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="2106d2"&gt;21:06 CET, DAY 2&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;I prepared 72 block's textures, some of them are old graphics from my games, some ale totally random, and I add also few Knockout's sponsors logos:). Choose your favorite and enjoy &lt;span style="font-weight:bold;"&gt;Massivetris&lt;/span&gt;!&lt;img src="http://images.virtualdesign.pl/images/57058avatars.jpg" width=430/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-1816833442278854525?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/1816833442278854525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/08/nodeknockout-timeline.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1816833442278854525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1816833442278854525'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/08/nodeknockout-timeline.html' title='NodeKnockout timeline'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-1719791591110325566</id><published>2010-08-27T09:42:00.000-07:00</published><updated>2010-08-27T09:52:14.034-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='nodeKO'/><title type='text'>NodeKnockout</title><content type='html'>It is about 7 hours to the &lt;a href="http://nodeknockout.com/"&gt;Node Knockout&lt;/a&gt;, last time for final preparations. Because I don't plan to sleep during that 48h, I prepare a lot of coffee and energy drinks as well as easy-to-eat stuff like frozen pizzas or fries. If it will be possible I will describe everything I will be working on here in near real time. Wish me luck!&lt;br /&gt;&lt;a href="http://images.virtualdesign.pl/images/10381nk.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/10381nk.jpg" width="430" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-1719791591110325566?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/1719791591110325566/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/08/nodeknockout.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1719791591110325566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1719791591110325566'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/08/nodeknockout.html' title='NodeKnockout'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-7861439171546386046</id><published>2010-08-21T09:03:00.001-07:00</published><updated>2010-08-24T08:20:39.785-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Random array sort in Javascript</title><content type='html'>There is such an array method called &lt;a href="http://www.w3schools.com/jsref/jsref_sort.asp"&gt;sort&lt;/a&gt;, which puts up the elements of an array in alphabetical order, changing it (without copying the whole array). Additionally, it takes also one function parameter for defining the order of elements. If it returns negative number, given elements will be switched, and when positive one, nothing will happen. So to sort an array in random order, it just need to return random numbers in -1 to 1 range.&lt;pre name='code' class = 'js'&gt;var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];&lt;br /&gt;a.sort(function(){ return Math.random()-0.5; }); &lt;br /&gt;//'a' is now something like &lt;br /&gt;//[9, 0, 2, 3, 4, 1, 8, 5, 6, 7]&lt;br /&gt;&lt;/pre&gt;&lt;img src="http://images.virtualdesign.pl/images/89551nodeko.png" style="float:left;margin:5px;width:80px;"/&gt;From the other hand, it is only one week to the &lt;a href="http://nodeknockout.com/"&gt;NodeKnockout&lt;/a&gt;. I'm really looking forward for this!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-7861439171546386046?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/7861439171546386046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/08/random-array-sort-in-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7861439171546386046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7861439171546386046'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/08/random-array-sort-in-javascript.html' title='Random array sort in Javascript'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4029039945033068488</id><published>2010-08-19T10:50:00.000-07:00</published><updated>2010-08-24T08:19:24.639-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><title type='text'>Detecting orientation change of mobile devices</title><content type='html'>Couple of weeks ago I was asked by one of the biggest online games company to adapt several of my games for their new portal designed for mobile devices. &lt;br /&gt;One of the most important thing in this venture was to disable orientation changing of the phone. Simplest way to check if it is in landscape or in portrait mode (in every device, because I know there are functions dedicated for Iphone and maybe some for Android also) is to check if height of the screen is bigger or lower than it's width.&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;function checkOrientation() {&lt;br /&gt;    if (window.innerHeight &gt; window.innerWidth) {&lt;br /&gt;        //portrait mode&lt;br /&gt;    } else if(window.innerHeight&lt; window.innerWidth) {        //landscape mode&lt;br /&gt;    }            &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;It's not possible to guess in which mode user enters the page (game in that case) so it's important to check it in the begging, and each time the browser's window resize.&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;        checkOrientation();&lt;br /&gt;        window.onresize = function() { //your code&lt;br /&gt;            checkOrientation();&lt;br /&gt;        }&lt;br /&gt;&lt;/pre&gt;Try this link from your phone to test it, or just open it in desktop browser and change window size: &lt;a href="http://virtualdesign.pl/examples/oc/"&gt;LANDSCAPE VS PORTRAIT&lt;/a&gt;&lt;br /&gt;I know it won't works in IE, but almost all of the mobile web browsers are based on &lt;a href="http://webkit.org"&gt;WebKit&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4029039945033068488?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4029039945033068488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/08/blocking-orientation-changing-on-mobile.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4029039945033068488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4029039945033068488'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/08/blocking-orientation-changing-on-mobile.html' title='Detecting orientation change of mobile devices'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4247079617005012699</id><published>2010-08-18T09:15:00.000-07:00</published><updated>2010-08-18T10:24:29.742-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Recursion of anonymous functions</title><content type='html'>When I declare anonymous function, like&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;(function(){&lt;br /&gt;    //do something...&lt;br /&gt;})();&lt;br /&gt;&lt;/pre&gt;name of the function is not added to any scope, either local or global, because there is no name at all. When I want to call the function again, for example in timer functions like &lt;span style="font-style:italic;"&gt;setTimeout()&lt;/span&gt;, I simply call &lt;span style="font-style:italic;"&gt;arguments.callee&lt;/span&gt; inside it&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;(function(){&lt;br /&gt;    //do something...&lt;br /&gt;    setTimeout(arguments.callee, 1000);&lt;br /&gt;})();&lt;br /&gt;&lt;/pre&gt;According to &lt;a href="https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Functions_and_function_scope/arguments/callee"&gt;Mozilla Developers Center&lt;/a&gt;:&lt;br /&gt;&lt;blockquote&gt;arguments.callee allows anonymous functions to refer to themselves, which is necessary for recursive anonymous functions.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4247079617005012699?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4247079617005012699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/08/calling-anonymous-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4247079617005012699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4247079617005012699'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/08/calling-anonymous-functions.html' title='Recursion of anonymous functions'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-1095070678287991270</id><published>2010-08-03T19:30:00.000-07:00</published><updated>2010-08-03T20:14:54.401-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='10K Apart'/><category scheme='http://www.blogger.com/atom/ns#' term='Stairs to heaven in 6.22 KB'/><title type='text'>"Stairs to heaven in 6,22KB" competition!</title><content type='html'>&lt;img src="http://images.virtualdesign.pl/images/83852tshir.jpg" style="float:right;width:150px;margin-left:3px;"/&gt;Inspired by few videos posted in comments I would like to announce a little competition. Rules are as simple as possible: &lt;a href="http://10k.aneventapart.com/Entry/36"&gt;play my "StHi6,22KB" game&lt;/a&gt;, make a video from it (using your mobile, camera or just record part of your desktop using programs like &lt;a href="http://camstudio.org/"&gt;CamStudio&lt;/a&gt;) with your result visible, upload it on any video-hosting site like Youtube or Vimeo and put the link in the comments on 10k Apart site (&lt;a href="http://10k.aneventapart.com/Entry/36#comments"&gt;here&lt;/a&gt;) &lt;span style="font-weight:bold;"&gt;before 25 of August&lt;/span&gt;. I will prepare two truly unique&lt;span style="font-weight:bold;"&gt; "Stairs to heaven in 6,22KB"&lt;/span&gt; T-shirts - one for the owner of the &lt;span style="font-style:italic;"&gt;best result&lt;/span&gt; and one for the &lt;span style="font-style:italic;"&gt;randomly chosen&lt;/span&gt; participant (e.g. by 'true random numbers generator - random.org). So, good luck and I'm waiting for your videos!&lt;br /&gt;&lt;br /&gt;My best try (of course it doesn't count):&lt;br /&gt;&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13843414&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=1&amp;amp;color=&amp;amp;fullscreen=1&amp;amp;autoplay=0&amp;amp;loop=0" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=13843414&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=1&amp;amp;color=&amp;amp;fullscreen=1&amp;amp;autoplay=0&amp;amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-1095070678287991270?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/1095070678287991270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/08/stairs-to-heaven-in-622kb-competition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1095070678287991270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1095070678287991270'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/08/stairs-to-heaven-in-622kb-competition.html' title='&quot;Stairs to heaven in 6,22KB&quot; competition!'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-982019315907916617</id><published>2010-07-31T20:37:00.000-07:00</published><updated>2010-08-01T05:26:56.782-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='microsoft'/><category scheme='http://www.blogger.com/atom/ns#' term='10K Apart'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='Stairs to heaven in 6.22 KB'/><title type='text'>10K Apart competition</title><content type='html'>&lt;img src="http://images.virtualdesign.pl/images/80525235px-Floppy_disk_2009_G1.jpg" style="float:right;margin:2px;width:200px;"/&gt;In the early '90, when I had my first contact with computers, I don't even heard about Cd-roms, or other freaky inventions like hard discs. I had 2 floppy stations, 3.5' and 5.25', with that 'bigger' (by size, no capacity) all the time busy with &lt;a href="http://en.wikipedia.org/wiki/DOS" target=_blank&gt;DOS&lt;/a&gt; disk, so everything I had was only 1.44MB. My favorite games then were Prince of Persia (yes, that one from top of this blog) and King's Quest (I finish it first time in my life after almost 18 years of playing, couple months ago on &lt;a href="http://sarien.net/kingsquest" target=_blank&gt;Sarien&lt;/a&gt;, online canvas versions of Sierra games). &lt;br /&gt;Today I felt a gust of those days. &lt;span style="font-style:italic;"&gt;'An Event Apart'&lt;/span&gt; organized crazy web-app competition called &lt;a href="http://10k.aneventapart.com/" target=_blank&gt;10K Apart&lt;/a&gt; with two main rules: total file size, including images, scripts and markup, must be under &lt;span style="font-weight:bold;"&gt;10K&lt;/span&gt; and app must work in &lt;span style="font-weight:bold;"&gt;IE9&lt;/span&gt;, Firefox and WebKit browsers.&lt;br /&gt;After about 8 hours of developing two games and bugfixing one annoying webportal simultaneously, let me introduce &lt;a href="http://10k.aneventapart.com/Entry/36" target=_blank&gt;Stairs to heaven in 6,22KB.&lt;br/&gt;&lt;img src="http://images.virtualdesign.pl/images/21035sth-big.jpg" width="430"&gt;&lt;/a&gt;&lt;br&gt;&lt;span style="font-weight:bold;"&gt;Enjoy and don't forget to click '5 stars' on 10kA site:).&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-982019315907916617?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/982019315907916617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/07/10k-apart-competition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/982019315907916617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/982019315907916617'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/07/10k-apart-competition.html' title='10K Apart competition'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-364913531270355225</id><published>2010-07-20T15:05:00.000-07:00</published><updated>2010-07-20T18:10:55.611-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='palm pre'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='porting'/><category scheme='http://www.blogger.com/atom/ns#' term='screen size'/><category scheme='http://www.blogger.com/atom/ns#' term='zombie eliminator'/><category scheme='http://www.blogger.com/atom/ns#' term='palm'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='palm pixi'/><category scheme='http://www.blogger.com/atom/ns#' term='zombies'/><title type='text'>Adapting to newer devices</title><content type='html'>After PRE, the next device introduced by PALM was called PIXI. It's one big mystery why newer, more complex and forward-looking device has smaller screen size than its predecessor. Nowadays, when mobiles has all the time more and more additional goodies, it's at least not really clever. But if we want to get to the widest audience our apps need to be flexible. Because I was anxious at the time, I chose the simplest way to run my &lt;a href="http://developer.palm.com/webChannel/index.php?packageid=zombie-eliminator"&gt;Zombie Eliminator&lt;/a&gt; also on Pixi - I just make 80px height 'dead zone' on the bottom. It is visible on PRE and hidden on PIXI. Simple &amp; working.&lt;br /&gt;&lt;center&gt;&lt;a href=http://images.virtualdesign.pl/images/16630prepixi.jpg&gt;&lt;img src="http://images.virtualdesign.pl/images/16630prepixi.jpg" width="430"/&gt;&lt;/a&gt;&lt;/center&gt;I recommend also nice art about Effective Design for Multiple Screen Sizes by Bryan Rieger at &lt;a href="http://mobiforge.com/designing/story/effective-design-multiple-screen-sizes"&gt;Mobi forge&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-364913531270355225?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/364913531270355225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/07/adapting-to-newer-devices.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/364913531270355225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/364913531270355225'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/07/adapting-to-newer-devices.html' title='Adapting to newer devices'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-8611361999231272313</id><published>2010-07-13T18:11:00.000-07:00</published><updated>2010-07-20T16:05:46.314-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='palm pre'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='published projects'/><category scheme='http://www.blogger.com/atom/ns#' term='zombie eliminator'/><category scheme='http://www.blogger.com/atom/ns#' term='palm'/><category scheme='http://www.blogger.com/atom/ns#' term='palm app catalog'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='zombies'/><title type='text'>First touch with Palm Pre</title><content type='html'>My 'Zombie Eliminator' is now ready to download for your PalmPre phone in official Palm App Catalog. Twelve levels of pure fun served in &lt;a href="http://michalbe.blogspot.com/2010/07/i18n-in-javascript-apps.html"&gt;sixteen languages&lt;/a&gt;. Check it:&lt;br/&gt;&lt;br /&gt;&lt;a href="http://developer.palm.com/webChannel/index.php?packageid=zombie-eliminator"&gt;&lt;img src="http://images.virtualdesign.pl/images/66101palm.jpg" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-8611361999231272313?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/8611361999231272313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/07/first-touch-with-palm-pre.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/8611361999231272313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/8611361999231272313'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/07/first-touch-with-palm-pre.html' title='First touch with Palm Pre'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-7603514394090029460</id><published>2010-07-07T15:26:00.000-07:00</published><updated>2010-07-07T16:37:14.407-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='MB engine'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><title type='text'>The "A Game By Its Cover" Competition</title><content type='html'>On the end of June the new&lt;a href="http://forums.tigsource.com/index.php?topic=13392.0"&gt; "A Game By Its Cover" Competition&lt;/a&gt; started on the &lt;a href="http://www.tigsource.com/"&gt;TIGSource&lt;/a&gt;.&lt;br /&gt;&lt;blockquote&gt;"A Game By Its Cover" is a game development competition based on how people's work inspires others to think in new and wonderful ways. In it we'll make real games out of fake game carts whose creators probably never imagined would become something real!&lt;/blockquote&gt;&lt;br /&gt;Because I like the idea, and I was looking for some simple project to test first options of my Javascript canvas-based game engine, you can watch progress of my "Real-time tree growing simulation" in &lt;a href="http://forums.tigsource.com/index.php?topic=13719.msg404283#msg404283"&gt;this threat&lt;/a&gt; on TIGForums. &lt;br /&gt;&lt;center&gt;&lt;a href="http://virtualdesign.pl/games/SuperForester/" target=_blank&gt;&lt;img src="http://images.virtualdesign.pl/images/5619sf.png" style="margin:5px;width:300px"/&gt;&lt;/a&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-7603514394090029460?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/7603514394090029460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/07/a-game-by-its-cover-competition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7603514394090029460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7603514394090029460'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/07/a-game-by-its-cover-competition.html' title='The &quot;A Game By Its Cover&quot; Competition'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4868117918323238863</id><published>2010-06-01T18:50:00.000-07:00</published><updated>2010-06-01T20:18:19.611-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='webkit'/><category scheme='http://www.blogger.com/atom/ns#' term='rhodes'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='qt'/><category scheme='http://www.blogger.com/atom/ns#' term='phonegap'/><category scheme='http://www.blogger.com/atom/ns#' term='symbian'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing" play-off</title><content type='html'>&lt;img src="http://images.virtualdesign.pl/images/58731172px-Qt-logo.svg.png" style="float:right;margin-left:10px;width:80px;"/&gt;Few hours before I want to send our game to Ovi challenge I read on the site that organizers gave us additional week for app polishing. I don't think it was necessary - my game was complete on Monday, about 7-8am. I will use my extra time to change it from WRT widget to Symbian app. &lt;br /&gt;About an hour after the announcement I found something called &lt;a href="http://rhomobile.com/"&gt;Rhodes&lt;/a&gt;, but using of Ruby and that all 'Network synchronization' stuff effectively deterred me. &lt;br /&gt;What I found next was &lt;a href="http://www.phonegap.com/"&gt;PhoneGap&lt;/a&gt;. Quoting creators:&lt;br/&gt;&lt;br /&gt;&lt;blockquote&gt;PhoneGap is an open source development framework for building cross-platform mobile apps. Build apps in HTML and JavaScript and still take advantage of core features in iPhone/iTouch, iPad, Google Android, Palm, Symbian and Blackberry SDKs&lt;/blockquote&gt;&lt;/br&gt;&lt;br/&gt; It was everything I need. It seems that it also supports Symbian. My first try was &lt;a href="http://phonegap.pbworks.com/PhoneGap-Symbian-%28Qt%29"&gt;'Get Started with Symbian (Qt)'&lt;/a&gt; part from the tutorial. I installed another tons of useless stuff (really - it was another 20GB to make it 'works'). &lt;br /&gt;I did my best but nothing seems to work properly or even close to. I googled thousands of different forums, blogs, tutorials and manuals with no result. I even try to search for my answers on &lt;a href="http://stackoverflow.com/"&gt;Stack&lt;/a&gt;, where i found nothing. So I asked new question in there and few hours later I got &lt;a href="http://stackoverflow.com/questions/2941447/symbian-qt-phonegap-files-not-found-in-qt-creator"&gt;the answer&lt;/a&gt; (from one of the phoneGap developers), from which i concluded that it simply doesn't work. Fine. So I had to write something on my own.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/68857webkit-logo.png" style="float:left;margin-right:10px;width:80px;"/&gt;One of the methods that come to my mind was to render HTML/JS in simple browser-like application. It is possible for example using &lt;a href="http://webkit.org/"&gt;WebKit&lt;/a&gt;. &lt;br /&gt;Tired of installing millions of plug-ins, libs, etc. I download &lt;a href="http://www.forum.nokia.com/info/sw.nokia.com/id/e920da1a-5b18-42df-82c3-907413e525fb/Nokia_Qt_SDK.html"&gt;Nokia SDK All in one Beta&lt;/a&gt; and start new 'Mobile QT Application' project in Qt Creator.&lt;center&gt;&lt;a href="http://images.virtualdesign.pl/images/11705qtc.jpg"/&gt;&lt;img src="http://images.virtualdesign.pl/images/11705qtc.jpg" width=430/&gt;&lt;/a&gt;&lt;/center&gt;I will explain later what to do if we want render our applications with WebKit, now I'm happy that it works fine. I made minor changes in the game, like control system (now there are no buttons, you simply tap the screen - character goes in direction of your tap. I will also try with accelerometer). Tomorrow I will test it on device and if everything will go well I will submit it to the challenge.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4868117918323238863?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4868117918323238863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/06/impossible-is-nothing-play-off.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4868117918323238863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4868117918323238863'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/06/impossible-is-nothing-play-off.html' title='&quot;Impossible is nothing&quot; play-off'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-6796440335980326436</id><published>2010-05-29T16:54:00.000-07:00</published><updated>2010-05-29T20:15:26.494-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing" 9 : 2</title><content type='html'>&lt;img src="http://images.virtualdesign.pl/images/28216finishline1.jpg" width=150 style="float:right; margin-left:15px"/&gt;I decide not to show everything in here - it has to be a little mysterious and something must motivate you to play when the game will be finished:). What I want to say &amp; show today, two days before the deadline, is very simple table based map editor I write in about 200LOC with simple DOM manipulation using 24 sewers tiles placed in one png file. It is easy and not so annoying to use, just watch the video below. Second part shows early location exiting/entering (it is already changed), Zombies AI, and better than yesterday connected map tiles.&lt;br/&gt; I don't know if tomorrow I will have time to write something because of last corrections. Results will be announced on 3rd June, I have good feelings because it is my birthday, so keep your fingers crossed.&lt;br/&gt;&lt;br /&gt;&lt;center&gt; &lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12141543&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=12141543&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-6796440335980326436?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/6796440335980326436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-9-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6796440335980326436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6796440335980326436'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-9-2.html' title='&quot;Impossible is nothing&quot; 9 : 2'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-770432891116943125</id><published>2010-05-28T22:29:00.001-07:00</published><updated>2010-05-28T23:06:10.457-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing" 8 : 3</title><content type='html'>IAs I promised before, here is the simple few seconds long video with basic gameplay on uncut scenery tiles. I want to focus now on mechanics, not visual details (I will improve it tomorrow or during the day after). &lt;center&gt;&lt;br /&gt;&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12126837&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=12126837&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/center&gt;&lt;br /&gt;There is no interaction with Zombies and no Survivors for now, that is my job for the next days.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-770432891116943125?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/770432891116943125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-8-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/770432891116943125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/770432891116943125'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-8-3.html' title='&quot;Impossible is nothing&quot; 8 : 3'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-3704005410649003325</id><published>2010-05-27T19:19:00.000-07:00</published><updated>2010-05-27T20:01:28.779-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing", first week off, 4 more days.</title><content type='html'>Today I improved frame rate detection using &lt;a href="http://www.javascript-games.org/"&gt; Scott Porter's&lt;/a&gt; Gamelib javascript library, modified by &lt;a href="www.def-logic.com"&gt;Brent Silby&lt;/a&gt;. Now it keeps constant number of frames on each device, I don't have to calibrate engine when I want test it on Nokia's, and i gained beautiful loading screen for introductory splash graphics. I will write something more about the library later. &lt;br /&gt;I also fix few bugs, change sprites for that prepared by Kuba and start to think about particular missions. Unfortunately because of deadline getting closer every second, we decide to make only 2-3 different 'levels' with 5-6 missions each. It seems to be enough for 10-days-created game:). Last but not least for today - meet our survivors:&lt;br /&gt;&lt;a href="http://images.virtualdesign.pl/images/79095postacie.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/79095postacie.jpg" width=430/&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-3704005410649003325?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/3704005410649003325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-first-week-off-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3704005410649003325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/3704005410649003325'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-first-week-off-4.html' title='&quot;Impossible is nothing&quot;, first week off, 4 more days.'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-7136166106645267832</id><published>2010-05-26T16:32:00.000-07:00</published><updated>2010-05-26T17:53:06.438-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing" 6th day - after the half-way point</title><content type='html'>Okay, we have now only 5 more days to deadline so without unnecessary words let me introduce Mr. &amp; Mrs. Zombie as a first gamesprites created by &lt;a href="http://kubalesniewski.carbonmade.com/"&gt;Kuba&lt;/a&gt;:&lt;br /&gt;&lt;a href="http://images.virtualdesign.pl/images/14384zombieb.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/14384zombieb.jpg" width=430/&gt;&lt;/a&gt;No more pandas:). Tomorrow I will try to record screencast from my emulator to show some gameplay details.&lt;br/&gt;&lt;br/&gt;And  continuing saint war between Flash-lovers and JavaScript developers - &lt;a href="http://www.apple.com/hotnews/thoughts-on-flash/" target=_blank&gt;Thoughts on Flash&lt;/a&gt; directly from the Apple.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-7136166106645267832?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/7136166106645267832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-6th-day-after.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7136166106645267832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/7136166106645267832'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-6th-day-after.html' title='&quot;Impossible is nothing&quot; 6th day - after the half-way point'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4126562250831987000</id><published>2010-05-25T19:15:00.000-07:00</published><updated>2010-05-25T19:38:32.373-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing" 5th day - six to go.</title><content type='html'>Today I expand features of my Map editor. It's now ready for multiple type tiles and 'special' cells (like that which are teleporting you to given place when you stand on it).&lt;br/&gt; As I planned I also add first enemies - for now colorful pandas instead of zombies. I gave them simple AI using which they will moving in the player's direction. &lt;br/&gt;I also change my plans about placing enemies and items on the map. I have no time for that. Maps will be designed using map editor, but all element like zombies, pellets and other items will be placed using random techniques (and it will change every time you get out and get back to the screen - I think that makes game more interesting and 'a little bit frightening' - you never know what is around the corner). Check first 15 screens of game world in the editor's mode preview with one screen pasted directly from the game:&lt;a href="http://images.virtualdesign.pl/images/99356mapeditor2.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/99356mapeditor2.jpg" width=430/&gt;&lt;/a&gt;&lt;br /&gt;And yes, I have changed tiles from simple red/yellow because they 'irritated' my eyes:), but this is still not target graphics.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4126562250831987000?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4126562250831987000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-5th-day-six-to-go.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4126562250831987000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4126562250831987000'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-5th-day-six-to-go.html' title='&quot;Impossible is nothing&quot; 5th day - six to go.'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-345642141308487820</id><published>2010-05-24T18:36:00.000-07:00</published><updated>2010-05-25T03:21:36.673-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='tile map'/><category scheme='http://www.blogger.com/atom/ns#' term='game mechanics'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><category scheme='http://www.blogger.com/atom/ns#' term='zombies'/><title type='text'>"Impossible is nothing" 4th day, Only a week more.</title><content type='html'>After first tests on mobile device my game seems to work. I've done basic logic such as displaying player, simple map (with locations and moving between them) and player control - with collisions with the environment. Tomorrow i will work on enemies (finally, ZOMBIES!) and survivors. I want to finish engine in next two days and use rest of the time to build world, expanded with many locations and put final graphics on. I already found graphic designer with enough free time in that week to make some sprites and tiles - meet &lt;a href="http://kubalesniewski.carbonmade.com/"&gt;Kuba from HighColors&lt;/a&gt;. And meet first Zombie I've ever seen - 1st location guy from Resident Evil (it was 1996 on PSX)&lt;br/&gt;&lt;img src="http://images.virtualdesign.pl/images/21555resident-evil-zombie.jpg" width=430/&gt;&lt;br /&gt;And one technical aspect of designing tileset-based map movement. Let us consider map created from simple array with '0' as road and '1' in the role of wall, e.g.&lt;br /&gt;&lt;pre name=code class=js&gt;&lt;br /&gt;map[0] = [];&lt;br /&gt;map[0].push([0, 0, 1, 0, 0, 0, 0]); //0&lt;br /&gt;map[0].push([0, 0, 1, 0, 0, 0, 0]);&lt;br /&gt;map[0].push([0, 0, 1, 0, 1, 1, 0]); //2&lt;br /&gt;map[0].push([0, 0, 0, 0, 0, 0, 0]);&lt;br /&gt;map[0].push([0, 0, 1, 0, 1, 0, 0]); //4&lt;br /&gt;map[0].push([0, 0, 1, 0, 1, 0, 0]);&lt;br /&gt;map[0].push([1, 1, 1, 0, 1, 0, 0]); //6&lt;br /&gt;map[0].push([0, 0, 0, 0, 1, 0, 0]);&lt;br /&gt;map[0].push([1, 1, 1, 1, 1, 1, 1]); //8&lt;br /&gt;map[0].push([0, 0, 0, 0, 0, 0, 0]);&lt;br /&gt;&lt;/pre&gt;Movement and collision detection are easy if we want our character just 'jump' from one cell to another. We need then simply calculate if destination tile is not '1'type (wall). &lt;br /&gt;&lt;pre name=code class=js&gt;&lt;br /&gt;var x = (player.xPosition/tileSize) + deltaX, &lt;br /&gt;    //if we move along X axis deltaX is 1 or -1 and deltaY is 0&lt;br /&gt;    y = (player.yPosition/tileSize) + deltaY; &lt;br /&gt;    //and vice versa in here&lt;br /&gt;&lt;br /&gt;if (map[actualMapIndex][y][x] !== 1) {&lt;br /&gt;&lt;br /&gt;       //move player&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;    displayFunnyWallHitAnimation();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;It gets complicated when we want it to take smaller steps, what is necessary if we want animation. For example our player moves 9px each step in 50px big tile. Because DOM coords are calculated from top-left corner, we can observe case in which our character is moving 'on the wall', like that:&lt;br /&gt;&lt;a href="http://images.virtualdesign.pl/images/90285panda1.jpg" target=_blank&gt;&lt;img src="http://images.virtualdesign.pl/images/90285panda1.jpg" width=430/&gt;&lt;/a&gt;&lt;br /&gt;With yellow fields as roads, red walls &amp; dark blue dot as sprite's 0,0. We can see that 0 point of the sprite is on the road but the sprite itself is traveling on the wall. So I got the idea of adding one more point to that, i call it x2, like that:&lt;br /&gt;&lt;pre name=code class=js&gt;&lt;br /&gt;var x = ((player.xPosition+tileSize*0.2)/tileSize) + deltaX,&lt;br /&gt;    x2 = ((player.xPosition+tileSize*0.8)/tileSize) + deltaX&lt;br /&gt;    y = (player.yPosition / tileSize) + deltaY;&lt;br /&gt;&lt;br /&gt;if (map[actualMapIndex][y][x] !== 1 &amp;&amp; map[actualMapIndex][y][x2] !== 1) {&lt;br /&gt;&lt;br /&gt;   //move player&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;&lt;br /&gt;    displayFunnyWallHitAnimation();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;I add 1/5 size of the tile to the 0.0 point, and 4/5 for another one. It's because my sprite has a little free, transparent space from each size. In practice it looks like that:&lt;br /&gt;&lt;a href="http://images.virtualdesign.pl/images/7424panda2.jpg" target=_blank&gt;&lt;img src="http://images.virtualdesign.pl/images/7424panda2.jpg" width=430/&gt;&lt;/a&gt;&lt;br /&gt;And because of kind of isometric (or oblique) view I use ('will use', because it's hard to say about perspective if i have only semi-colored squares as background), i don't have to introduce additional point in Y-s. It looks good when character is standing in front of the wall like on screen below (like in the old Pokemon games for gameboy).&lt;a href="http://images.virtualdesign.pl/images/533panda3.jpg" target="_blank"&gt;&lt;img src="http://images.virtualdesign.pl/images/533panda3.jpg" width=430 /&gt;&lt;/a&gt;&lt;br /&gt;Ok, I will return to developing now, because, paraphrasing &lt;a href="http://en.wikiquote.org/wiki/George_Bernard_Shaw"&gt;George Bernard Shaw&lt;/a&gt; (I don't really remember how it was originally), "Able is creating, unable is teaching" , and I always find writing blogs as a kind of teaching:).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-345642141308487820?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/345642141308487820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-4th-day-only-week.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/345642141308487820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/345642141308487820'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-4th-day-only-week.html' title='&quot;Impossible is nothing&quot; 4th day, Only a week more.'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-8363324683562845146</id><published>2010-05-23T19:47:00.000-07:00</published><updated>2010-05-24T06:38:57.577-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing" 3rd day, only 8 more</title><content type='html'>Ok, finally I have an idea. Thanks to &lt;a href="http://www.comixpedia.org/index.php?title=Sean_Howard"&gt;Squidi's&lt;/a&gt; so-called GameDocs,&lt;a href="http://www.joystiq.com/2010/05/21/google-celebrates-pac-mans-30th-with-playable-logo"&gt; PacMan's birthday&lt;/a&gt; the day before yesterday and my true zombie-love I have a plan. I decide to design everything for &lt;a href="http://en.wikipedia.org/wiki/Nokia_5800_XpressMusic"&gt;Nokia 5800 XpressMusic&lt;/a&gt; (with 360x640 resolution) with very simple reason - that is one my neighbor have so I can test my game on it. &lt;br /&gt;I use  simple map editor I write before, initially for my first &lt;a href="http://apps.facebook.com/vd_snake/"&gt;FaceBook Snake&lt;/a&gt; (where I finally never use it), used later in &lt;a href="http://michalbe.blogspot.com/2010/04/eastern-compo-2010.html"&gt;Eastern Compo Game&lt;/a&gt;. I made 7x10 map of 50px height tiles, what gives me up to 90px on the bottom of the screen for navigation panel (coz that device had no keys). Now I have to find someone who can make me some graphic.&lt;br /&gt;&lt;a href=http://images.virtualdesign.pl/images/34628biurko2.jpg&gt;&lt;img src=http://images.virtualdesign.pl/images/96048biurkomale.jpg width=430/&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-8363324683562845146?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/8363324683562845146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-3rd-day-only-8.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/8363324683562845146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/8363324683562845146'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-3rd-day-only-8.html' title='&quot;Impossible is nothing&quot; 3rd day, only 8 more'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-190855168090840967</id><published>2010-05-22T11:45:00.000-07:00</published><updated>2010-05-23T20:41:37.168-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing" 2nd day - 9 days left</title><content type='html'>To create any game, you need:&lt;img src="http://images.virtualdesign.pl/images/1711WRT_logo.jpg" style="float:right"/&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;idea&lt;/li&gt;&lt;br /&gt;&lt;li&gt;skills&lt;/li&gt;&lt;br /&gt;&lt;li&gt;time&lt;/li&gt;&lt;br /&gt;&lt;li&gt;tools&lt;/li&gt;&lt;br /&gt;&lt;li&gt;and resources&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;As I wrote in previous post, I have no skills in mobile dev, no idea for any interesting app, and I'm run out of time. What I have today are tools.&lt;br /&gt;&lt;br /&gt;All night long i read mostly everything in the web about creating mobile widgets in web technologies. It wasn't so easy because &lt;a href="http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/"&gt;Nokia's site&lt;/a&gt; is one big mess with everything upside-down. I download tons of stuff from there (really, it is almost 10GB, with most annoying thing ever - &lt;span style="font-weight:bold;"&gt;Symbian Emulator&lt;/span&gt; which is 4GB big and you have to reinstall it every time you want to clear all preferences. Fortunately &lt;a href="http://www.aptana.org/"&gt;Aptana&lt;/a&gt; has additional plugin with browser-based Nokia device emulator too), install everything they asked me to, read and tried to understand every "Getting started" and "Hello World!" tutorials, and not sleep at all. &lt;br /&gt;Finally, I can proudly say that it is working. First photo of some pre-prototype game-like application running on Nokia's device (I don't even have one, thank one more time to Owca for help).&lt;br&gt;&lt;br /&gt;&lt;img src="http://images.virtualdesign.pl/images/58490screen1.jpg" width=430/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-190855168090840967?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/190855168090840967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-2nd-day-9-days.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/190855168090840967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/190855168090840967'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-2nd-day-9-days.html' title='&quot;Impossible is nothing&quot; 2nd day - 9 days left'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-891791154420475294</id><published>2010-05-21T09:01:00.000-07:00</published><updated>2010-07-12T20:27:38.515-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Impossible is nothing'/><title type='text'>"Impossible is nothing" 1st day - 10 days left</title><content type='html'>Ok, I give up with J2ME. My mate &lt;a href="http://fromzerotocodehero.blogspot.com/"&gt;Jakub a.k.a Owca&lt;/a&gt; had an idea of cool J2me application inspired by alcoholic blackouts, with very strong chance to win &lt;a href="http://www.developerschallenge.pl/konkurs.html"&gt;ODC&lt;/a&gt;, but unfortunately Blue-tooth implementation for our needs was to difficult to overcome. Now we have 10 more days (challenge ends 31 May, at 15:00 Central European Time), no experience or even skills in mobile development for Nokias, no idea of any awesome app that could win, and no money to drink from grief. &lt;br /&gt;&lt;center&gt;&lt;br /&gt;&lt;a href="http://images.virtualdesign.pl/images/52916questionmark.jpg"&gt;&lt;img src="http://images.virtualdesign.pl/images/52916questionmark.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;But there is a little light at the end of the tunnel. According to &lt;a href="http://www.forum.nokia.com/Technology_Topics/Web_Technologies/Web_Runtime/QuickStart.xhtml"&gt;Nokia Forum&lt;/a&gt; there is some way to write mobile applications using Web Technologies, such as HTML/CSS and our favorite JavaScript. I have to get familiar with that. We'll see what will happen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-891791154420475294?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/891791154420475294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-day-1st.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/891791154420475294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/891791154420475294'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/impossible-is-nothing-day-1st.html' title='&quot;Impossible is nothing&quot; 1st day - 10 days left'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-2813644860720017386</id><published>2010-05-13T18:47:00.000-07:00</published><updated>2010-05-17T07:11:20.298-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><title type='text'>Mobile applications</title><content type='html'>Best proof that it's time for develop something for mobile devices is that in new Photoshop option 'Save for Web...' changed into 'Save for Web &amp; Devices...'. That's why in my free time I'm working on social-like fun and nice application for &lt;a href="http://www.developerschallenge.pl" target=_blank&gt; Ovi Dev Challenge&lt;/a&gt;. I have almost two weeks, I have to speed up a little. Wish me luck &amp; keep your fingers crossed:).&lt;img src="http://images.virtualdesign.pl/images/78042avila.jpg" width=430/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-2813644860720017386?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/2813644860720017386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/mobile-applications.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/2813644860720017386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/2813644860720017386'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/mobile-applications.html' title='Mobile applications'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-4678921019516271032</id><published>2010-05-05T15:47:00.000-07:00</published><updated>2010-05-05T17:49:12.594-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='puzzle'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Simple puzzle game</title><content type='html'>Internet is full of different programming frameworks. Nowadays you don't have to learn new language, you only need to know any friendly and easy to use framework and you can start your adventure with code.&lt;br/&gt;&lt;br /&gt;I don't like that. I can't 'feel' the code when I use frameworks for everything. I got a feeling that it's no more mine - I just 'press a magic button' and some hard to understand and explain things happen. For sure - it's not serious to code huge project in pure code. But if it's your first contact with new programming language - try to explore it on your own. Try to understand what it's all about. And then feel free to use whatever you want - it's ok if you understand more or less what happens behind the scenes.&lt;br/&gt;&lt;br /&gt;Today was my first serious attempt to create js game using something different than &lt;img style="float:right;margin:5px" src="http://images.virtualdesign.pl/images/6505jquery.JPG"/&gt;pure JavaScript. I choose jQuery because I made before a few projects using it. And here it is, a simple puzzle game like almost 10years old &lt;a href="http://www.smashcat.org/puzzle/clix/" target=_blank&gt;Clix&lt;/a&gt;. In few words, quoting &lt;a href="http://www.javascriptgaming.com/"&gt;www.javascriptgaming.com&lt;/a&gt;:&lt;br/&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;When you click a block (...) it and all neighbours that are the same color disappear. Gravity makes the blocks above fall down, creating new opportunities.&lt;br /&gt;&lt;br /&gt;If a column is completely cleared, the remaining columns are moved closer together. When (...) the screen is all clear, the game is over. Points are awarded for clearing groups of blocks, the more blocks you remove in one click, the more points.&lt;/span&gt;&lt;br/&gt;&lt;br /&gt;The only difference is that in my version there are new 'blocks' each 3 lvls. You have 11 levels of fun in FB version and unlimited in nonfacebook one (but there are only 5 types of 'mojito-blocks').&lt;br/&gt;&lt;a href="http://images.virtualdesign.pl/images/72916modzajto.jpg" target=_blank&gt;&lt;img src="http://images.virtualdesign.pl/images/72916modzajto.jpg" width=430/&gt;&lt;/a&gt;&lt;br/&gt;&lt;a href="http://images.virtualdesign.pl/images/48178modzajto2.JPG" target=_blank&gt;&lt;img src="http://images.virtualdesign.pl/images/48178modzajto2.JPG" width=430/&gt;&lt;/a&gt;&lt;br/&gt;Try it on facebook (in Polish, click 'GRAJ' to play):&lt;br /&gt;&lt;a href="http://apps.facebook.com/modzajto/"&gt;http://apps.facebook.com/modzajto/&lt;/a&gt;&lt;br/&gt;or outside:&lt;br/&gt;&lt;a href="http://vdev.x25.pl/modzajto_nfb/"&gt;here.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-4678921019516271032?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/4678921019516271032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/05/another-simple-puzzle-game.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4678921019516271032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/4678921019516271032'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/05/another-simple-puzzle-game.html' title='Simple puzzle game'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-5678687061634095383</id><published>2010-04-19T09:45:00.000-07:00</published><updated>2010-04-19T16:54:50.994-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='snake'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Isometric Snake game for Facebook</title><content type='html'>During the weekend I went with my girlfriend to my countryside house. Anyway, I didn't want to waste my daily gamedeveloping time.&lt;br /&gt;I created there simple &lt;span style="font-weight:bold;"&gt;snake game&lt;/span&gt; (days ago one of the most popular mobile game for Nokia cells) with isometric graphic. I modify sprites from &lt;a href="http://en.wikipedia.org/wiki/File:IsometricFlaw_2.svg" target=_blank&gt;one wikipedia graphic&lt;/a&gt; and use logic from &lt;a href="http://apps.facebook.com/vd_snake/" target="_blank"&gt;my old Snake game&lt;/a&gt;. &lt;br/&gt;&lt;a href="http://images.virtualdesign.pl/images/99426snake3dscreen.JPG"&gt;&lt;img src="http://images.virtualdesign.pl/images/99426snake3dscreen.JPG" width=430/&gt;&lt;/a&gt;&lt;br/&gt;Find &lt;span style="font-weight:bold;"&gt;VD SNAKE 3d&lt;/span&gt; on Facebook or simply try this link: &lt;a href="http://apps.facebook.com/vd_snakeiso/"&gt;http://apps.facebook.com/vd_snakeiso/&lt;/a&gt;. &lt;span style="font-style:italic;"&gt;(My average result is &lt;span style="font-weight:bold;"&gt;700points&lt;/span&gt;, what's yours:)?)&lt;br /&gt;You can also &lt;a href="http://www.facebook.com/apps/application.php?id=114845045206512"&gt;&lt;span style="font-weight:bold;"&gt;become a fan&lt;/span&gt;&lt;/a&gt; of the game.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-5678687061634095383?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/5678687061634095383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/04/isometric-snake-game-for-facebook.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5678687061634095383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5678687061634095383'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/04/isometric-snake-game-for-facebook.html' title='Isometric Snake game for Facebook'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-6389929123122187930</id><published>2010-04-05T15:34:00.000-07:00</published><updated>2010-04-19T10:14:44.156-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='competition'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='tower defense'/><category scheme='http://www.blogger.com/atom/ns#' term='compo'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Eastern Compo 2010</title><content type='html'>It's almost tradition that during Eastern Holidays &lt;a href="http://gamedev.pl"&gt;Warsztat&lt;/a&gt; members organize special edition of &lt;span style="font-weight:bold;"&gt;Compo&lt;/span&gt; (game developing competition, &lt;a href="http://www.gamedev.pl/compo/"&gt;check&lt;/a&gt;). Randomly chosen topic of competition was "A game with particles-effect, Zombies, arrows and deadly spikes". Quite creative.&lt;br/&gt; &lt;a href="http://images.virtualdesign.pl/images/22786zombi1.JPG"&gt;&lt;img src="http://images.virtualdesign.pl/images/22786zombi1.JPG" width=430/&gt;&lt;/a&gt;&lt;br /&gt;I tried to create Tower Defense Game with Zombies as creatures, particle-flame throwers and spike-guns as towers and arrows as obstacles. I use some old javascript particle effects and try even to build few fire-towers. Unfortunately JS and web browsers are not adapted to generate thousand of tiny objects. It worked fine with one tower, very bad with two of them, and with three haven't work at all. Because of that I decided that required 'particle effect' will be "Hell fire", shown on spawn place of Zombie creatures. The same situation was with spike/nail guns. So i change my mind and simply put spikes like arrows - on the ground as obstacles. It took me about 8 hours to design, code, prepare the graphics and test the game, so it is not finished at all.&lt;br/&gt; &lt;a href="http://images.virtualdesign.pl/images/80455zombi2.JPG"&gt;&lt;img src="http://images.virtualdesign.pl/images/80455zombi2.JPG" width=430/&gt;&lt;/a&gt;&lt;br/&gt; Finally, except me, there was only one participant took part in Compo, so there was no results. If you are interested in my game, download it here: &lt;a href="http://budzyk.x25.pl/syntaxH/files/wielkanocne.rar"&gt;EasternCompo [290KB]&lt;/a&gt; &lt;br/&gt;(Readme and gui are in polish, sorry).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-6389929123122187930?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/6389929123122187930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/04/eastern-compo-2010.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6389929123122187930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/6389929123122187930'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/04/eastern-compo-2010.html' title='Eastern Compo 2010'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-5027289520582237161</id><published>2010-03-04T14:37:00.000-08:00</published><updated>2010-05-13T19:55:46.863-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='ie hack'/><category scheme='http://www.blogger.com/atom/ns#' term='prototype'/><title type='text'>Removing item with given value from an Array in Javascript</title><content type='html'>&lt;span style="font-weight:bold;"&gt;'Delete'&lt;/span&gt; operator is the easiest way to remove from Javascript's array elements with given index. It works fine with objects like literals but using it on arrays is worst thing you can ever do. What happens if you try?&lt;br /&gt;&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;var tab = [1,2,3];&lt;br /&gt;delete tab[1];&lt;br /&gt;//result: [1, undefined, 3]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It just removes particular element, not even try to fix undefined space left after the operation. So its better to use &lt;span style="font-weight:bold;"&gt;splice()&lt;/span&gt; instead.&lt;br /&gt;&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;var tab = [1,2,3];&lt;br /&gt;tab.splice(1, 1);&lt;br /&gt;// result: [1, 3]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Okey, but what to do if we have to remove item with some given value? We can google a little and find how to expand &lt;span style="font-weight:bold;"&gt;prototype&lt;/span&gt; of an Array object with &lt;span style="font-weight:bold;"&gt;remove()&lt;/span&gt; method, like that:&lt;br /&gt;&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;Array.prototype.remove = function(value) {&lt;br /&gt;       this.splice(this.indexOf(value), 1);&lt;br /&gt;       return true;&lt;br /&gt;};&lt;br /&gt;a=[112, 234, 32545];&lt;br /&gt;a.remove(234);&lt;br /&gt;// a is [112, 32545];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It works for that case, for sure, but what when item we try to find is not in our array? &lt;span style="font-weight:bold;"&gt;indexOf()&lt;/span&gt; will return &lt;span style="font-weight:bold;"&gt;-1&lt;/span&gt;, and &lt;span style="font-weight:bold;"&gt;splice()&lt;/span&gt; will start to removing elements from end of an array. &lt;br /&gt;&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;a=[112, 234, 32545];&lt;br /&gt;a.remove(22);&lt;br /&gt;//a is [112, 234]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Not funny. So to avoid situations like that we have to put one additional condition to our method. &lt;br /&gt;&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;Array.prototype.remove = function(value) {&lt;br /&gt;    if (this.indexOf(value)!==-1) {&lt;br /&gt;       this.splice(this.indexOf(value), 1);&lt;br /&gt;       return true;&lt;br /&gt;   } else {&lt;br /&gt;      return false;&lt;br /&gt;   };&lt;br /&gt;} &lt;br /&gt; &lt;br /&gt;a=[112, 234, 32545];&lt;br /&gt;a.remove(234);&lt;br /&gt;// [112, 32545];&lt;br /&gt;a.remove(22); &lt;br /&gt;// still [112, 32545];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Everything's fine. But in &lt;span style="font-weight:bold;"&gt;IE&lt;/span&gt; (there is always some 'but' in there, thanks Bill), for sure in 6.0, i don't know about new versions, Array type Objects have no &lt;span style="font-weight:bold;"&gt;indexOf()&lt;/span&gt; method, so we have to build it on our own:&lt;br /&gt;&lt;pre name='code' class = 'js'&gt;&lt;br /&gt;if(!Array.indexOf){ &lt;br /&gt;    Array.prototype.indexOf = function(obj){&lt;br /&gt;        for(var i=0; i &lt; this.length; i++){&lt;br /&gt;            if(this[i]==obj){&lt;br /&gt;                return i;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return -1;&lt;br /&gt;    };&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now it works fine. Thanks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-5027289520582237161?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/5027289520582237161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/04/removing-item-with-given-value-from.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5027289520582237161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/5027289520582237161'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/04/removing-item-with-given-value-from.html' title='Removing item with given value from an Array in Javascript'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2037107846963035846.post-1619632909877764832</id><published>2010-03-03T14:56:00.000-08:00</published><updated>2010-04-16T15:14:10.031-07:00</updated><title type='text'>var blog = new Blog();</title><content type='html'>Syntax highlighting test:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="python"&gt;&lt;br /&gt;#!/usr/bin/env python&lt;br /&gt;# encoding: utf-8&lt;br /&gt; &lt;br /&gt;from django.core.mail import send_mail&lt;br /&gt;from django import forms&lt;br /&gt;from registration.forms import RegistrationForm&lt;br /&gt;from registration.models import RegistrationProfile&lt;br /&gt;from django.conf import settings&lt;br /&gt;from accounts.models import User, UserProfile&lt;br /&gt;from django.forms import ModelForm&lt;br /&gt; &lt;br /&gt;class UserProfileForm(ModelForm):&lt;br /&gt;class Meta:&lt;br /&gt;model = UserProfile&lt;br /&gt;exclude = ('user')&lt;br /&gt;fields = (&lt;br /&gt;    'about',&lt;br /&gt;    'image',&lt;br /&gt;    'address_street',&lt;br /&gt;    'address_city',&lt;br /&gt;    'address_zip',&lt;br /&gt;    'address_country',&lt;br /&gt;    'phone'&lt;br /&gt;    )&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2037107846963035846-1619632909877764832?l=michalbe.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://michalbe.blogspot.com/feeds/1619632909877764832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://michalbe.blogspot.com/2010/04/var-blog-new-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1619632909877764832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2037107846963035846/posts/default/1619632909877764832'/><link rel='alternate' type='text/html' href='http://michalbe.blogspot.com/2010/04/var-blog-new-blog.html' title='var blog = new Blog();'/><author><name>MichalBe</name><uri>http://www.blogger.com/profile/08931175956259148276</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-Iz1YA-h7554/ThA6Yzhy3VI/AAAAAAAAAJU/dfNQhjC2bZc/s1600/mb.png'/></author><thr:total>0</thr:total></entry></feed>
