Adding Images and Moving Objects with Corona SDK

This post is a tie in to the YouTube Video – Adding Images and Moving Objects with Corona SDK.

In this short game development tutorial with Corona SDK, learn how to add an image to your game and how to move an image. We’ll be using two functions display.newImageRect for adding images and transition.to for moving objects.

You can download player.png by clicking the following link – download player.png. This graphic is provided by Kenney. Due to a server loss, I no longer have the original player.png graphic. However, any graphic that’s 66×92 will work great. If you have another size, just change the 66 and 92 to the appropriate width and height.

First, you will need to add an image to the game by entering the following code:

local myPlayer = display.newImageRect("player.png", 66, 92)
 myPlayer.x = 100
 myPlayer.y = 125

To move an object within your game, use the following code:

transition.to(myPlayer, {x=250, y=250, time=12000})

And that’s it for adding images and moving objects using Corona SDK! Thanks for watching!

Leave a Reply

Your email address will not be published. Required fields are marked *