Tuesday, 7 September 2010

Android App Inventor

So, I just got accepted to the app inventor beta.  First impressions: it's really really shiny, but there are some functions that I would really love but can't find for the life of me...

(warning - geeky stuff ahead)
I got an HTC Desire a few months back.  It's truly a delight to use, and my tariff is really very reasonable at £27.50 per month for 600 mins, unlimited texts and data and 50 MMS messages. Of course, unlimited really isn't, as the fair use policy limits me to 3000 texts and 750mb data - that's more texts that I've ever sent in my life, but the data use could be an issue if I have a particularly excessive month.  Still, I'm happy with the package overall.

I was really interested in the openness of the Android marketplace, and was keen to develop my own apps, but I've been too busy to get really interested in developing in Java (as I've never used it before, and don't really have time to learn).  I was very interested in the potential of the PHP for Android team and have done some work on that, but the big problem with that is that it doesn't let you create your own interface - you're currently still stuch with whatever you can code with PHP (so you're somewhat limited to website-like behaviour).

The Android App Inventor came along.  I applied for the beta weeks ago, when it was first reported in the Register.  I just got my invite last weekend, and I've managed to find a little time to play with it.  I've done the first three tutorials (out of 13) and got a little inspired to have a play (I was never very good at RTFM).

App Inventor is incredibly versatile - the Blocks editor lets you build all sorts of dynamic events, and you can do clever things like calling other apps and passing information between them (although not a lot of information), and you can build little databases to keep track of information.  I've yet to cover all of what it can do, but I have found what seem to be a couple of holes in the language.  There are three things that I can't figure out an easy way to do that I'd love to - that is: write to the SD card, create a new component and delete a component.

I'm trying to see if I can build a tower defense type game (as I enjoy playing them) and I can't figure out a way to save information between games (ideally I'd leave a little txt file on the SD card, that was suitably excrypted so that people couldn't easily tamper with it).  There are workarounds - I could use TinyDB or send the data to the web (both of which I need to really look at) but it's not anywhere near as easy as it could be.

Currently the game is very primitive.  I've got a creep that moves down the screen and a tower that fires at it, and when the creep reaches 0 hit points, it vanishes (note, vanishes rather than is destroyed). The game currently increases your score with each hit.  The creep's hit points and the tower's damage and range are determined by global variables, so they're easy to play with.  My todo list at present is:

Implement cash for kills
Add a pause button
Enable saving of progress
add a speed toggle (done, but doesn't work)

Tower placement by touch
make it so that towers that shoot at only one enemy at a time (currently, any enemy in their range when they fire is hit)
Allow more than one tower (costing money)
Tower upgrades (costing cash for increased range and/or power [and possibly firing rate?])
Extra types of tower (high damage, low firing rate?  high range, low damage? AoE, etc)

Create more than one Creep
set up waves with increasing hp
Create more than one type of Creep (faster, armoured, more hp?)
implement a path that's not just a straight line

I think I know how to do all of this with what we have available, but it'll be really really messy as I'll have to create 20 or so Creep sprites and set their variables so that they get re-used in each wave.  I'll also have to make as many tower sprites as I think the user may want to place, which will likely be a lot.  This would be a lot easier if I could create and destroy the sprites on the fly.  Anyone know of a way?

I'm enjoying it so far, may post updates as I go along...

No comments: