For any application to start we'll need to make a main.lua
file. This has been discussed in the previous chapter when we worked with some sample code and ran it with the simulator.
The code will be structured accordingly in your main.lua
by the time the game is completed:
Necessary Classes
(For example: physics or ui)
Variables and Constants
Main Function
Object Methods
Call Main Function
(This always has to be called or your application will not run)
Formatting your code to make it look like the preceding structure is 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 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 player interacts with the Play button. We'll also...