Years ago I wrote a tutorial on how to make a bouncing ball in ActionScript, along with gravity and the ability to drag and throw the ball. That was 2001 and I still get emails almost weekly from people who are reading it and learning something from it (though how they get that ancient code to work is beyond me). When I wrote my book, Foundation ActionScript Animation: Making Things Move! I expanded the concepts there and that became the basis for a good chunk of the first half of the book.
Well, I recently decided to learn Objective C in an attempt to recreate my Gravity Pods game for the iPhone. I worked through several chapters of a couple different books and learned quite a bit, and decided to branch out on my own.
I think when most people start learning a language, they have a particular thing that they program to help them learn the language. It helps to have an app or example that you are familiar with as a goal to implement in a new environment. It’s a personal “Hello World” type thing. For John Grden, it’s a Star Wars trench run (LOVE YOU JOHN!). For me, it’s a bouncing, throwable ball with gravity. It has a bunch of different concepts – animation, screen refreshes / redraws, velocity, acceleration, collision detection and reaction, friction, user interaction. Once you know how to do all that in a language, you can really start do do any kind of game or animation with it.
So that’s what I did this weekend. And here is the result:
As you can see, I not only got all the elements of the original gravity tutorial going, I even added in accelerometer detection! I’m pretty psyched about how far I got with it in such a short time. I still have a lot more to learn to create a full game, but I might expand this into some small free apps – just fun toys to play around with – and submit them for release.