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 – adding game objects


Let's add in the display objects the player will see while in game play:

  1. After the loadGame() function, we're going to create another function that will display all our game objects on screen. The following lines will display the art assets that were created for this tutorial:

    function addGameScreen()
    
      background = display.newImage("bg.png", 0, 0, true )
      background.x = _W 
      background.y = _H
      
      paddle = display.newImage("paddle.png")
      paddle.x = 240; paddle.y = 300
      paddle.name = "paddle"
      
      ball = display.newImage("ball.png")
      ball.x = 240; ball.y = 290
      ball.name = "ball"
  2. Next, we'll add in the text that will display the score and level number during the game:

      scoreText = display.newText("Score:", 25, 10, "Arial", 14)
      scoreText:setFillColor( 1, 1, 1 )
    
      scoreNum = display.newText("0", 54, 10, "Arial", 14)
      scoreNum: setFillColor( 1, 1, 1 )
    
      levelText = display.newText("Level:", 440, 10, "Arial", 14)
      levelText:setFillColor( 1, 1,...
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)