Game Development Reference
In-Depth Information
Here's the code for Corona SDK:
function getPosition(theObj)
if theObj == nil then return end
theObj:setReferencePoint(display.TopLeftReferencePoint)
return theObj.x, theObj.y
end
And here's the code for Gideros Studio:
function getPosition(theObj)
if theObj == nil then return end
return theObj:getPosition()
playSound that plays sound as required.
Here's the Corona SDK version:
function playSound(theSound)
audio.play(handle)
end
And here's the Gideros Studio version:
function playSound(theSound)
local channel = theSound:play()
return channel
end
We will have to change the way we set up the sounds array because of the way we index the sounds
when playing them.
Here's what we need to use in Corona SDK:
function setupSound()
sounds = {
explosion = audio.loadSound("_001.wav"), -- explosion
shoot = audio.loadSound("_002.wav"), -- shoot bullet
collectSurvivor = audio.loadSound ("_003.wav"), -- collect survivor
collectFuel = audio.loadSound ("_004.wav"), -- collected fuel
crash = audio.loadSound ("_005.wav"), -- crash
}
end
 
Search WWH ::




Custom Search