Tracking the lives left in the game keeps the player updated on how much sooner it will be till the game is over. To count the remaining lives in the game, perform the following steps:
livesCount()
:local livesCount = function()
gameLives = gameLives - 1 livesText.text = "Lives: " .. gameLives livesText.xScale = 0.5; livesText.yScale = 0.5 --> for clear retina display text livesText.x = (480 - (livesText.contentWidth * 0.5)) - 15 livesText.y = 15 print(gameLives .. " eggs left") if gameLives < 1 then callGameOver() end end
Currently, the game uses display text on screen to show how many lives are left during game play. A way to make the HUD display more appealing is by creating/adding small icons that correlate with the game, such as eggs or a frying pan.
Our main character will be animated for every action applied during game play. We will also create a complex body construction since the focus of its collision points will be on the object the character is holding, and not on their entire body.