Search PalmPower's 487 Palm-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
PROGRAMMING POWER
Rocketship: writing a PalmPilot game
By Alan Jay Weiner

My son Daniel likes to play with the PalmPilot. As he's only three, most of the games are too advanced for him, although he does like DinkyPad and the "walking game" (Kyle's Quest).

This month we'll put together a small game for him. It's simple; we can expand it next month. Actually, it's not much of a game; more of a time-waster, but it's the structure for a game. We can expand on it another time.

Daniel's a typical boy; he likes motorcycles, spaceships, knights, and anything that can be turned into a gun (which he calls a "shoot gun"). At various times he either wants to be a policeman or a "bad guy." I think we'll use spaceships for this gameÉ And no shooting.

This month's version of "Daniel's Rocketship" starts with a rocket sitting on a launch pad, as shown in Figure A. When launched, it flies upward. The hardware buttons control movement left and right. As yet, there's no goal - the rocket takes off, flies to the top of the screen and the "game" is done. This is probably a bit simple, even for Daniel.

FIGURE A

Running in the emulator, our rocket has just launched. Note the smoke/fire effect.

Rocketship is based on the original "Hello, world" application I wrote in March; most of the code will be quite familiar. The new parts include using the hardware buttons and doing things as time elapses.

3É 2É 1É BLASTOFF!
I use a simple technique for animating the rocket. There are four bitmaps: the rocket (shown in Figure B), the launchpad and gantry (shown in Figure C), a blank bitmap used to clear the rocket, and a bitmap of "smoke" as the rocket lifts off.

FIGURE B


The rocket is a simple bitmap. Roll over picture for a larger image.

FIGURE C


This simple set of perpendicular lines becomes the gantry when the rocket is overlayed upon it. Roll over picture for a larger image.

Initially, I draw (well, the program draws) the launchpad and gantry. Daniel launches the rocket by tapping anywhere on the screen or by pressing the "up" button. At launch, I draw the "smoke" bitmap. Then, each time a set time period goes by, I erase the rocket and re-draw it one pixel higher.

Instead of using a blank bitmap to erase the rocket, I could use WinEraseRectangle. This would make a slightly smaller program; there'd be no blank bitmap. For now, it's convenient to just draw the blank bitmap though.

Watching the clock
PalmPilot programs go idle when nothing is happening. During this idle time, power usage is drastically reduced; this is key to extended battery life.


1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Phones and PDAs > Palm and Treo > Software (211 articles)
   TealOS: great Palm software you are prohibited from buying
   CallRec gives your Treo better call recording
   Edit Office files on the go with Documents To Go
Home > Phones and PDAs > Palm and Treo > Programming (24 articles)
   How PDA software is born
   Program with Simplicity
   Kinectivity 2.0 brings enterprise application developers new tools
Home > Games > Palm Games > Writing a Game (3 articles)
   Finishing up Rocketship
   Setting application preferences
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Other PalmPower Articles
Palm gets up to date with new Tungsten family of handhelds
Create handwritten email with riteMail
Presenter-to-Go puts PowerPoint presentations on your Palm OS handheld
Looking for the cutting edge
Gain remote access to databases and PLCs
PalmSource Open House showcases what's new in the Palm community
Analysis: handheld market share
More from the ZATZ journals
Computing Unplugged: Eight steps to successful and reliable home backups
David Gewirtz Online: CNN commentary and analysis
DominoPower: What to look for in a Domino-based document management solution
OutlookPower: Can Outlook run when it's not running (and other mysteries)?
-- Advertisement --

NO HASSLE PHOTO PRINTING, SHARING, AND STORAGE -- AS LOW AS $2.54 PER MONTH
Discover an easier way to share, print and manage your photos online! Get your own online photo album site for sharing photos, as well as easy-to-use editing tools to make sure your photos look their very best. You can even order high quality prints directly from your album -- and have them delivered right to your door!

Best of all, you can also get login-free photo sharing at your personal domain name (if you have one), so your friends and family don't have to hassle with signing up or logging in just to view your pictures. It's the perfect solution for sharing, printing and storing all your favorite images!

And it's only from The Duck! Tap here to get started.

-- Advertisement --

SECURE YOUR SITE WITH AN IRONCLAD SSL CERTIFICATE
An IronClad SSL Certificate helps you build an impenetrable fortress around your customer's credit card information. IronClad SSL Certificates are:

  • Fully validated
  • Up to 256-bit encryption
  • Up to 10 years validity
  • Stringent authentication
  • Around-the-clock customer support

Build trust. Protect your customers. Grow your online business.

Tap here now and be IronClad with SSL tonight.

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2009, ZATZ Publishing. All rights reserved worldwide.
Editor's Login