Game Development Reference
In-Depth Information
destroyObject(bullets[i].sprite)
table.remove(bullets, i)
end
wTime = 2
position(heli,_W/2,_H/2)
gameOver = lives <= 0
setVisible(heli, not gameOver)
setVisible(txtGameOver, gameOver)
setVisible(txtTapAgain, gameOver)
setVisible(tanker, false)
position(tanker, _W + random(3,5) * tanker.width, baseLine - tanker.height)
if gameOver == true then
if floor(distance) + score > hiscore then
hiscore = floor(distance) + score
end
-- showReplayScreen()
end
end)
end
Since we need to create a generic set of functions to accommodate several frameworks, we
have a couple of new functions like setVisible and bringToFront , which allows us to show or
hide the objects or re-order the display of the objects.
Here's the code for Corona SDK:
function setVisible(theObject, setHow)
if theObject == nil then return end
theObject.isVisible = setHow or false
end
And here's the code for Gideros Studio:
function setVisible(theObject, setHow)
if theObject == nil then return end
local setHow = setHow or false
theObject:setVisible(setHow)
end
The bringToFront function is defined as follows in Corona SDK:
function bringToFront(theObject)
if theObject == nil then return end
theObject:toFront()
end
 
Search WWH ::




Custom Search