Day 14 – Learning Android Development

Today I reviewed the tutorial  from yesterday. I started adding little stuff to the game, all by myself. I can’t believe how much more I learned by trying to add stuff to the game, than actually reading the tutorial line by line or re-doing it. When you want to add something by yourself, you have to find a way to do it, and you search and try until you can. It’s trial and error. Of course you need to first take a look at all the clases and see how they’re connected to each other and have a little background knowledge on how the game was built. Not to forget you have to know some java as well. But as I said, after all that, the best way to keep improving is implementing stuff yourself.

Here’s how the game has evolved visually. The images are from the PC version, but the same goes for the android version, both use the same source.

[slideshow]

Bob has now become bigger and is a kind of space trooper. The blocks are now some type of concrete, and there’s a space themed background. Some quick photoshop did the work, I find it really great for pixel art.

On the technical front, the game has evolved as well. Now you Bob turns right and left, so he doesn’t only see on one direction anymore. I spent a great deal of time figuring out the collision detection’s parameters with bob and the blocks.  I know one of the ways you do it is by setting up a big if-statement within a loop traversing the blocks, the if-statement will return true when one block is near and then you make bob’s speed zero and he can only go to the opposite direction. What i took time with was finding the right numbers, how far should bob stop from the blocks, etc. Plus I had a bug where he would magically appear next to the block he was being blocked at, very cool.

I probably added some other minor things I don’t quite recall at the moment. I want to keep working on this game for a bit, mess around with it to see if I can implement jumping, more  levels, AI, shooting. Definetly gravity, because right now he just walks at a height of 2 units, whether there’s a block or not.

I really like the MVC style, you separate the models (Bob,world,blocks), the view(rendering) and the controller(input/event handler) in different classes. Makes things more organized.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *