Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By : Michelle M Fernandez
Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By: Michelle M Fernandez

Overview of this book

Table of Contents (19 chapters)
Corona SDK Mobile Game Development Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – placing images on screen


We're finally getting into the visually appealing part of this chapter by starting to add in display objects using images. We don't have to refer to the terminal window for now. So, let's focus on the simulator screen. We'll begin by creating a background image and some art assets by performing the following steps:

  1. First off, create a new project folder on your desktop and name it Display Objects.

  2. In the Chapter 2 Resources folder, copy the glassbg.png and moon.png image files and the config.lua file into your Display Objects project folder.

  3. Launch your text editor and create a new main.lua file for your current project.

  4. Write out the following lines of code:

    local centerX = display.contentCenterX
    local centerY = display.contentCenterY
    
    local background = display.newImage( "glassbg.png", centerX, centerY, true)
    local image01 = display.newImage( "moon.png", 160, 80 )
    
    local image02 = display.newImage( "moon.png" )
    image02.x = 160; image02.y = 200
    
    
    image03...