AJAXAFY-PAGE-START

Friday, July 27, 2007

Arkonoid Game on the iPhone?


Somewhere I found after fishing around on the internet, an Arkonoid clone done completely in DHTML. Although not perfect, this game by Scott Schiller I consider it well done.




I did notice that the game did not work in IE6. I haven't tested it in IE7 yet. It worked fine in FireFox and Safari running on a Windows XP box.


And, what I'm really trying to get to is it runs on an iPhone (sort-of). Scott mentions that he modified the game to work on the iPhone (sort-of), so, Wednesday night after dinner, I bid my wife ado and went off to the Apple store at the Oakbrook Centre. In my pocket written on a yellow index card was the URL listed above. I entered the URL into an iPhone there and tried out the game. Below are a few comments I have regarding it:


  • First some positive things... The game is playable, unlike the one I'm working on. But bearly so. More on this later.

  • The ball / paddle speed in the game is good. I have a ball and paddle in my game but they move much too slow on the iPhone.

  • The graphics for the game (on the iPhone or in a regular web browser) is very sharp and professional looking.

  • Despite self-effacing comments at the top of the main Javascript file, I think the coding is pretty well documented (not perfect but still pretty good). There is alot here that a Javascript developer can learn from.

  • Now the negative... I had to do the finger-pinch (or is it unpinch) move to zoom the page big enough to play the game.

  • The button to start the game is way too small for iPhone usage. I had to zoom the page even more just to get it so I could barely press it will my finger without pressing buttons on either side.

  • The hack he implented for the iPhone is that you can press a spot on the x-axis to move the paddle to. You cannot slide the paddle back and forth. This works rather clunky.

Application
I plan on studying the Javascript for this game. The main reason, I want to find out how Scott kept his game performance good even on the iPhone. I have some ideas on how to track paddle movement based on a post I read on the iPhoneWebDev Google group. I want to create a test event page more suitable to my needs and post it on Chomer.com. Then I will go to the Apple store again and try out my test page to collect more detailed event information. And, finally (I hope), I will update my game so that it actually works correctly!

Labels: , , , ,

Monday, July 23, 2007

iPhone event handling frustration

I went with my wife on Friday evening to Oakbrook Centre to the Apple store and tapped in the URL for my iPhone game.
  • The game fits in the screen properly.
  • The game's attract mode worked pretty good, but it ran WAY slower than it did in the Safari browser on my PC at home.
  • Tapping the screen did start the game, but...
  • onmousemove did not work.

I've been scouring the internet looking for information on how to use the proper event handlers in Javascript to make it so the user can use his finger to move a paddle back and forth over the screen (this info is a little hint on the game I am working on). I've had very little luck so far.

As far as speed, I might be able to set the setTimeout timer value to a smaller value when running on an iPhone.

I'm somewhat stumped regarding the paddle control right now. Any ideas regarding how to do this in Javascript?

Labels: , ,

Tuesday, May 08, 2007

Is Javascript js File Loaded?

I learned a little coding tip over the weekend. I was monkeying around with Microsoft's mapping mashup, and I found that every now and then I'd get an Javascript error. Basically saying that the function I was calling did not exist. I came up with the following idea to deal with the problem:

<html>
<head>
<title>Sample Page</title>
<script src="Includes/sample.js"
language="Javascript"></script>
<script language="Javascript">
function initPage() {
   if (sampleFunc == null) {
      setTimeout("initPage()",100);
      return false;
   } // end if

   // now that it exists, call it!
   sampleFunc();
} // end of function initPage()
</script>
</head>
<body onload="initPage()">

</body>
</html>


This little sample will give the web browser more time to download the sample.js file. But it will do it in such a way as to not lock up the entire browser whilst it's waiting!

Labels:

Friday, April 20, 2007

Friday at 6

It is 6:09pm Friday evening and I am still at work. Two meetings, no working phone on my desk. Hmmm. I've not gotten alot done at work today. Did some coding (mainly javascript) for the project I'm working on. Tried getting on one conference bridge today with my cell phone. The conference bridge would have none of it!

I'm trying to push myself to code a bit more. I'm toggling back and forth from this Blogger edit window to my text editor where I have my javascript.

Bah! Well, I just got a little more code put in.

Alright, I better finish this post, and call my wife from my cell phone so she doesn't worry.

Labels: , ,

AJAXAFY-PAGE-END