Another two films at the cinema

I met Cheryl on old market square after work yesterday and we went to the cinema in time for the 17:30 showing of The A-Team. It was every bit as silly as I imagined it would be. Some bits are even more ridiculous than I expected (flying a tank, etc.). It was also as full of explosions and shooting as I hoped it would be. 🙂 It’s worth going to watch if you fancy a funny action movie.

After the film we went to pick up our tickets for the 9pm showing of Twilight: Eclipse. when we had the tickets we headed to Chiquito to get some Mexican food. I tried another sub-par quesadilla while Cheryl had macaroni and cheese (yes, really).

Eclipse itself was kind of like this for me:

First 90 minutes
Bella looks just to the left of Edward with a pained expression on her face looking slightly confused by something in the distance.
Bella looks just to the left of Jacob with a pained expression on her face looking slightly confused by something in the distance, then breaks her hand punching him in the face after he kisses her.
Edward does his necessary macho thing to Jacob, then they both pull back with pained expressions on their faces.
Bella looks upset, still.
Bella kisses Jacob, Edward doesn’t mind because he knows Bella loves him more than Jacob.

The next 20 minutes
There’s an awesome fight scene with werewolves and vampires all over the place!

The last 10 minutes
Teenage girl heaven.

Bring It! – Getting started

To begin developing my game I downloaded the latest Android SDK and set up Eclipse as explained in great (and hopefully up-to-date) detail on Google’s instructions page.

Once this was working I got the latest version of the Rokon game engine and extracted it into my workspace folder. I imported the existing project into Eclipse and added my own class to the list. I copied one of the examples into my own class and then removed the com.rokon.examples class and files. I changed all references of the com.rokon.examples class to my own class in files like the AndroidManifest.xml file. I missed a few places at first, but Eclipse is pretty good at telling you what’s wrong. I found it helpful to clean the project using the Project->Clean menu item to make sure no errors were left over from before certain changes.

Once I had eradicated all errors from Eclipse I ran the source in an Android Virtual Device. To my immense surprise it was working!

I went into the code and started to strip out all the bits I didn’t want. I kept one sprite around, but changed the sprite texture to my own arrow, and made it considerably smaller.

That was all pretty easy, and I thought things were going to well until I realised that I now needed to get down to the harder stuff. The user would need to aim in different directions from one point, so I needed a way for the person to change the angle. My first thought was to use the scroll ball that appears on most HTC devices these days. I thought that might be a bit of a problem though, because I was planning on using the scroll ball press as the trigger, and that might lead to people accidentally pressing it when they didn’t want to.

I decided that it would be cool to have the character point towards where the user pressed on the screen. The problem with that is that code is required to work out what angle to rotate the character by depending on where the character is, and where the player has pressed on the screen. I managed to find various little bits and pieces online that helped me come up with a decent solution.

That looks very complicated, but it’s not that bad, really. The angle is worked out using the position of the centre of the sprite and the position of the press on the screen. I’d explain it in more detail, but that might take a while. You may notice the +90 near the end of the rotation line. Unfortunately that’s a bit of a hack to add 90 degrees of rotation to whatever angle is given to me. It works, so I’m fine with that for now.

Now when I run the “game” I see an arrow on the screen. If I press on the screen then the arrow points at where I pressed. If I move my finger while it’s pressed then the arrow follows my finger around. A good start to coding the actual character.

Now to climb the rest of the mountain!