We will create an iPhone version of the popular arcade game Whac-A-Mole. When the game starts, moles (an animal) will begin to pop up from the bottom of the screen. The objective of the game is to hit the mole, thereby adding to the player's score:
Create an application using the following command:
motion create GameApp
Now, as we are using an external library for our application, let's first install
CocoaPods
. Run the following commands on your terminal:$ sudo gem install cocoapods $ pod setup $ sudo gem install motion-cocoapods
Update the
Rakefile
:$:.unshift("/Library/RubyMotion/lib") require 'motion/project' require 'motion-cocoapods' Motion::Project::App.setup do |app| # Use 'rake config' to see complete project settings. app.name = 'GameApp' app.pods do pod 'cocos2d' end end
Now we are all set to begin coding for our app.