There are many variations on how to incorporate a physics engine using display objects. So far, we have worked on removing objects with collisions, moving objects through the stage area, and launching objects by applying force against gravity, just to name a few. Now, we will explore another mechanism that allows gravity to control the environment. The next game we'll create deals with falling physical objects.
In this chapter, we will:
Here's to creating another fun, simple game in this chapter. Let's get cracking!
Every step taken so far has taught us more about game development on iOS/Android devices. In this new segment, our game will include sound effects, which will enhance the sensory experience in our games.
The new game that we will create is called Egg Drop. The player controls the main character, which is a lumberjack with a frying pan. During game play, eggs start falling from the sky, and it is the lumberjack's job to catch the eggs in his frying pan and not let them hit the ground. Every egg caught earns 500 points. The player starts with three lives. When an egg fails to hit the frying pan and hits the ground, a life is lost. When all three lives are gone, the game is over.
When starting the new game project, be sure to grab the Egg
Drop
file from the Chapter
7
folder. You can download the project files accompanying this book from the Packt Publishing website at http://www.packtpub.com/. It contains all the necessary files that are built out for you, such as the build.settings
, config.lua
, and audio files, and the art assets needed for the game. You'll then have to create a brand new main.lua
file in the project folder before you start coding.
This will be our first full game setup, which will be filled with notable Corona SDK features. We'll combine our base knowledge of what we have learned so far with variables, display objects, the physics engine, touch/accelerometer events, and audio. Many of Corona's APIs are easy to use and understand. This shows the fast learning curve with Corona just by having basic to no knowledge of programming.