Reader small image

You're reading from  Corona SDK Mobile Game Development: Beginner's Guide

Product typeBook
Published inMar 2015
Publisher
ISBN-139781783559343
Edition1st Edition
Tools
Right arrow
Author (1)
Michelle M Fernandez
Michelle M Fernandez
Right arrow

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...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Corona SDK Mobile Game Development: Beginner's Guide
Published in: Mar 2015Publisher: ISBN-13: 9781783559343

Author (1)