Corona SDK and other Game Development Tutorials

Developing a Game with Corona SDK, Third Steps

Hello! Today’s post is going to be a short one but a very important one, adding sound! I added a coin.wav and to when the player collects a coin. Here’s the code.

-- Added to line 16
snd_coin    = audio.loadSound("coin.wav") -- Set coin sound variable

-- Added to line 126;

I know this is a short and simple, but it’s important to have sound in your game. As always, you can download the full source code below.

Download Source Code

  1. Putting * guy.isFixedRotation = true * at the end of the add guy section helps the guy image from falling when hit by a coin during a jump.

    — Add Guy
    guy = display.newImage( “images/guy.png” )
    physics.addBody( guy, “dynamic”, { friction=0.5, bounce=0 } )
    guy.x = math.random(100,_W-100); guy.y = 170;
    guy.myName = “guy”
    guy.isFixedRotation = true

Leave a Reply