<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>dom on Arunrocks</title>
    <link>https://arunrocks.com/tags/dom/</link>
    <description>Recent articles in dom on Arunrocks</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 15 Feb 2006 18:08:19 +0530</lastBuildDate><atom:link href="https://arunrocks.com/tags/dom/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Reverse : A Javascript Game in 24 hours</title>
      <link>https://arunrocks.com/reverse-a-javascript-game-in-24-hours/</link>
      <pubDate>Wed, 15 Feb 2006 18:08:19 +0530</pubDate>
      
      <guid>https://arunrocks.com/reverse-a-javascript-game-in-24-hours/</guid>
      <description>&lt;p&gt;&lt;strong&gt;My 75th post!&lt;/strong&gt; (or so says my Wordpress engine), a big thank you to all those who have visited my little space on this sea of information. Is it now due to move to &lt;a href=&#34;http://wordpress.org/development/2006/01/201-release/&#34;&gt;Wordpress 2.0&lt;/a&gt;? I&amp;rsquo;ve read all the enhancements and me don&amp;rsquo;t think so :)&lt;/p&gt;
&lt;p&gt;With more and more projects like &lt;a href=&#34;www.basecamphq.com/&#34;&gt;Basecamp&lt;/a&gt; and &lt;a href=&#34;http://www.gmail.com&#34;&gt;Gmail&lt;/a&gt;, the application space within a browser is limited only by ones imagination. If AJAX sounds greek to you, probably you might not have heard about all the excitement behind it. Basecamp is already net&amp;rsquo;s most favourite Project Management tool. And you would really need to get out of that rock if you haven&amp;rsquo;t heard of Gmail.&lt;/p&gt;
&lt;p&gt;As a budding game developer I&amp;rsquo;m quite frankly petrified by the alarming growth of such web based apps (this includes &lt;a href=&#34;http://www.macromedia.com/software/flash/&#34; title=&#34;Macromedia Flash&#34;&gt;Flash&lt;/a&gt; based and Javascript based apps). These days I&amp;rsquo;m sceptical if a gamer would download a zip file or (&lt;em&gt;shudder&lt;/em&gt;) an EXE file and go through the installation to just try a game. All the while when there are many of your favourite games like &lt;a href=&#34;http://www.codingforums.com/showthread.php?t=71268&#34;&gt;Pac-man (-clone)&lt;/a&gt; and &lt;a href=&#34;http://www.elizium.nu/scripts/lemmings/&#34;&gt;Lemmings&lt;/a&gt; already ready for you to play. Well, I guess hard-core gamers would be put off by the slow interactions within a browser, but playing speed might just be a question of time.&lt;/p&gt;
&lt;p&gt;Anyways, I&amp;rsquo;ve decided to try my hand at some cool javascript coding. Right from the moment I discovered the game at &lt;a href=&#34;http://e-scribe.com/news/193&#34;&gt;E-Scribe&lt;/a&gt; I found it quite addictive. I just had to finish coding it. In fact, it must have actually taken me less than 5 hours to code, design artwork and test (in 3 browsers - &lt;a href=&#34;http://www.microsoft.com/windows/ie/&#34;&gt;IE&lt;/a&gt;, &lt;a href=&#34;http://www.mozilla.com/firefox/&#34;&gt;Firefox&lt;/a&gt; and &lt;a href=&#34;http://www.apple.com/macosx/features/safari/&#34;&gt;Safari&lt;/a&gt; !!!) meanwhile sippping tea over endless discussion in the foodcourt ;).&lt;/p&gt;
&lt;p&gt;For the impatient the game below is ready to play, so try it online, try it now ;)&lt;/p&gt;
&lt;h1 id=&#34;rules&#34;&gt;Rules&lt;/h1&gt;
&lt;p&gt;The objective is to arrange the some jumbled numbers into numbers in increasing order. At each step all you can do is click on a number. As a result all the numbers to the left of the number including the number will be reversed.&lt;/p&gt;
&lt;p&gt;For example, if the current list is 2 3 4 5 1 6 7 8 9 and you reverse 4, the result will be 5 4 3 2 1 6 7 8 9. Now if you reverse 5, you win.&lt;/p&gt;
&lt;h1 id=&#34;play-here-now&#34;&gt;Play here, now!&lt;/h1&gt;
&lt;iframe src=&#34;https://arunrocks.com/downloads/reversegame/reverse-js-game.html&#34; width = &#34;420&#34; height=&#34;100&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34;&gt;
&lt;/iframe&gt;
&lt;h1 id=&#34;reverse-in-your-website&#34;&gt;&amp;ldquo;Reverse&amp;rdquo; in your website?&lt;/h1&gt;
&lt;p&gt;Simple! Just copy paste the following code in your site&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;iframe src=&amp;quot;/downloads/reversegame/reverse-js-game.html&amp;quot;
width = &amp;quot;420&amp;quot; height=&amp;quot;100&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot;&amp;gt;
&amp;lt;/iframe&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Please give due credits. The code is release under the &lt;a href=&#34;http://www.gnu.org/copyleft/gpl.html&#34;&gt;GNU General Public License&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;learnings&#34;&gt;Learnings&lt;/h1&gt;
&lt;p&gt;&lt;em&gt;This section would be of interest only to Javascript developers&lt;/em&gt;
Some interesting lessons learnt whilst developing this game are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;IDE&lt;/strong&gt;: Mozilla Firefox is an excellent platform to develop JavaScript apps thanks to the &lt;em&gt;DOM Inspector&lt;/em&gt; and clickable &lt;em&gt;JavaScript console&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Presentation&lt;/strong&gt;: End output is very professional and customizable. This is due to usage of CSS which very effectively separates presentation from design. For eg: I can make any number of &amp;ldquo;skins&amp;rdquo; for this game. Also traditional game art resources such as fonts are already present &amp;ldquo;out of the box&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Paradigm&lt;/strong&gt;: Out of the box event handling model need some getting used to, especially for new programmers. This is especially true for timer code which I would expect most games to use extensively.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;innerHTML&lt;/strong&gt;: &lt;code&gt;innerHTML&lt;/code&gt; is not fully crossplatform. It is very useful for debugging hence was often used in alert boxes. Use for node creation use DOM functions such as &lt;code&gt;createElement&lt;/code&gt; or &lt;code&gt; appendChild&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Animation&lt;/strong&gt;: This was one of the primary reasons I wanted to turn the text based game in &lt;a href=&#34;http://e-scribe.com/news/193&#34;&gt;E-Scribe&lt;/a&gt; to a graphical one. It was no clear which digits were being swapped. Rather than go for a full blown fading/translating animation, I opted for a simple blink. As a result the gameplay is faster and more responsive.&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
  </channel>
</rss>
