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: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
DominoPower: Application development, William Shatner, and the origin of the universe
OutlookPower: More about disappearing text
-- Advertisement --

Sent Items Organizer
When you need to file your sent email into their proper folders based on keywords or who it's to. It's also perfect for shared mailboxes.

It also adds a "Send And File" toolbar button while you're composing (similar to the way Lotus Notes used to work) for quick and easy filing.

Find out more!

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