
The final step for the background is to position it at the correct location on the screen. In this case, we'll simply use the image's pixel dimensions, although as noted above, display.newImageRect() allows you to resize/scale the image via these numbers. The next two parameters, 360 and 570 specify the size that we want the background image to be. The specified name must match the actual file name exactly, including case-sensitive matching! For instance, if the actual file name is background.png, do not enter it as "BackGround.PNG". In this case, that value will be an image used as your background. A variable, just like you learned in math class, is used to store a value.
The first word, local, is a Lua command indicating that the next word will be a variable. There are a several aspects involved with this command. Local background = display.newImageRect( "background.png", 360, 570 ) In this a file, type in the highlighted command:. This is the Lua file with which the application starts, every time you run the app. The a file is the foundational "core program file" of every Solar2D project and you cannot create an app without it. Using your chosen text editor, locate and open the a file within your project folder. While there are ways to change the layering order of images and send them to the back or front of the display stack, we'll keep this project simple and load them in a logical order. Solar2D places everything on the screen from back to front in regards to layering, so the first image we load will exist behind other images that are loaded afterward.
The first image that we need to load is the background.