The story behind Space Hops

I wanted to write a post about developing my first game, Space Hops. I also realized that it is not entirely clear, based on the screenshots, how Space Hops works.

To begin, this is the first game I have ever programmed. I began learning about iPhone app programming when I purchased my first Mac this August (‘the grass is always greener on the other side…’, I finally converted).  I originally started with the course CS193 on iTunesU by Stanford University, but I decided I was more interested in game programming so looked elsewhere. It did provide me with a good idea of MVC and other things you need to keep when developing for the iPhone. I found cocos2d and decided it was a good place to start. It seemed to have plenty of learning resources available with a learning curve that is not too steep, but yet capable of making more complex games.

I went through a lot of tutorials Ray Wenderlich’s on website. Funnily enough I really struggled finding an idea for my first game. I wanted something unique, but a game wasn’t so complicated that I would get half-way through and realize there were many more complexities than I had originally planned for. I was most inspired by the simple game Fall Down as I remembering being addicted to it, despite it’s simplicity. I also liked Doodle Jump, which Space Hops turned out being more like.

In Space Hops the platforms move down the screen. There are four different types of platforms, all fall at the same speed, but move across the screen (x direction) at different speeds and directions. The character walks side to side on the platforms (based on the accelerometer), taps when you touch the screen, and gets one boost per jump when you tap again. One some of the platforms there are coins. Each coin gives you a bonus 100 points and adds one to your multiplier. As soon as you let one coin go off screen, your multiplier resets. There are also asteroids which you have to avoid.

One of the hardest parts of the game for me was trying to get the platforms to fall at the right speeds so that they started off the screen, and came across where I wanted them to. It also took a lot of tweaking to get the the amount by which the x and y values speed up for each type of platform to keep the platforms moving (relatively) the same way across the screen. It also took a lot of effort to get new platforms spawning correctly. Beyond that I found getting the walking animation working pretty difficult too, but could never find a good way to adjust it to the speed at which he was moving across the screen. As a result sometimes he looks like he sliding… but he’s in space so that’s okay.

Among the most difficult aspects, not at all related to the gameplay, was trying to get iAd’s into the Highscore screen. I originally tried AdWhirl, but it gave me so many problems I was forced to give up. It took a lot of research to find a method that works well with cocos2d v2.0, as most are for older versions of cocos2d. I will hopefully be posting a tutorial on this soon.

I added the following power ups:

  • Half Gravity
  • Double Gravity
  • 2x Multiplier
  • 3x Multiplier
  • 4x Multiplier
  • Coin Magnet
  • Jetpack
  • Infinite side scrolling
  • Extra Life

Programming Space Hops was a great learning experience, and a lot of fun. I am very excited to get started on my next. Just need to get ready for some programming competitions first.

I hope doing tutorials and posting source code on how to make most of the game. I found one of the best ways of learning for me was by watching how other games were made. Hopefully it passes it’s iTunes Review, and is available soon. Hope you enjoy it.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s