Archive for November, 2009|Monthly archive page

Easy, fun game sprites made with SVG!

I downloaded and installed Inkscape in order to draw an animation to play with the Scalable Vector Graphics API.  Inkscape was quite helpful for creating my game’s opening SVG animation (though it would have been more helpful if it could save the file in “SVG Tiny”…).  What I didn’t expect was how helpful Inkscape is for drawing standard game sprites — drawn first in Scalable Vector Graphics format, then exported as PNG files!

I needed an rocket sprite for my “Space Explorer” game.  Here’s what I came up with:


You can see that the four frames give a spinning effect.  (The lower row gives the frame sequence for when the engines are turned on.)  I’m more an engineer than an artist, but here’s how Inkscape and SVG made it easy for me to draw this: Continue reading

The BlackBerry Red Key!

When I’m running an application on a BlackBerry device — and I hit the red key — my app disappears, and the menu screen reappears. I’d guess that my app’s screen was popped off the BlackBerry screen stack, so onClose() was called and my app cleaned itself up neatly, right?

Wrong.  The application was merely sent to the background.

I assume this behavior is mentioned somewhere in the bowels of the RIM documentation (although I’ve read quite a lot of it, and I haven’t seen mention of this). Nor do the sample applications appear to deal with it. I just figured it out when my colleague Andrew Davison sent me a game that plays music in the background. It was a tad loud, so I instinctively tried to shut it off in one click using the red key. And the game went away, but the music kept right on playing…

It reminds me of a little something I read in the PodTrapper story:

My curve has 32MB of RAM and 64MB of flash. The flash can be used for paging if it’s available, but on my device only about 20MB of it is, and that fills up fast installing applications (PodTrapper alone is 350k). Realizing that the OS and other apps also have to fit in RAM, leaking a 100kb string becomes a huge problem. There are lots of forum posts by people trying to figure out why their phone keeps running out of memory and needs to be rebooted. It’s a large enough problem that there are apps for automatically restarting your phone. I can definitely see why Apple has been hesitant to open up background processing on the iPhone. It’s really easy for bad developers to make the whole platform look bad.

Personally, I think it’s kind of cool that you can run apps in the background on BlackBerry, and send them to the foreground and back. However, I think the simplest, default behavior should lean towards cleaning up the app neatly, while sitting on memory and processes when your app goes out of scope should be a special behavior that advanced developers can request.  Not the other way around.

So what about that red key?  What if you’re developing a game or animation that makes no sense in the background, and you just want it to clean up whenever the user dismisses it?

Andrew proposed the following solution (for use in a subclass of Screen):

Continue reading