5. Game Background

This code places the background image in the stage.

-- Game Background
gameBg = display.newImage('gameBg.png')

6. Add Cars

The next lines of code handles the cars' placement on the stage. Each line represents a car, its position, the graphic, the rotation, the direction and the name. We'll create that function later in the tutorial.

15. Collisions

Finally, we check for collisions. If the frog is hit by a car, the graphics are removed and a You Lose message is shown. When the three frogs have reached their goal, a You Win message will appear, ending the game.

17. Call Main Function

In order to start the game, the Main function needs to be called. With the above code in place, we'll do that here:

Main()

18. Loading Screen

The Default.png file is an image that will be displayed while the iOS loads the basic data to show the Main Screen. Add this image to your project source folder; it will be automatically added by the Corona compliler.

19. Icon

Using the graphics you created before, you can now create a nice and good looking icon. The icon size for the non-retina iPhone icon is 57x57px, but the retina version is 114x114px, and the iTunes store requires a 512x512px version. I suggest creating the 512x512px version first and then scaling down for the other sizes. It doesn't need to have rounded corners or transparent glare; iTunes and the iPhone will do that for you.

20. Testing in Simulator

It's time to do the final test. Open the Corona Simulator, browse to your project folder, and then click open. If everything works as expected, you are ready for the final step!

21. Build

In the Corona Simulator, go to File > Build and select your target device. Fill the required data and click Build. Wait a few seconds and your app will be ready for device testing and/or submission for distribution!

Conclusion

In this series, we've learned about moving an object using an on-screen pad and collision detection using the physics engine, skills that can be really useful in a wide number of games. Experiment with the final result and try to make your own custom version of the game! I hope you liked this tutorial series and found it helpful. Thank you for reading!