For any application to start, we'll need to create a main.lua
file. This has been discussed in Chapter 2, Lua Crash Course and the Corona Framework, when we worked with some sample code and ran it with the simulator.
The code will be structured accordingly in your main.lua
file by the time the game is completed:
Necessary classes (for example,
physics
orui
)Variables and constants
Main function
Object methods
Call main function (this has to be called always, or your application will not run)
Arranging your code to make it look like the preceding structure is a good practice on keeping things organized and running your application efficiently.
In this section, we'll be introducing the display group that will show the main menu screen and a Play button that the user will be able to interact with in order to move on to the main game screen. All in-game elements such as the paddle, ball, brick objects, and heads-up display elements follow after the...