Score HUD
Whenever a player hits a coin, kills a player, or picks a diamond, we would need to increase their score by 50, 100, and 150 respectively.
local score = 100 ---when player picks coin function CoinPick(v) v.picked = true CoinPicked = true score = score + 50 end ---when player picks coin function DiamondPick(v) v.picked = true DiamondPicked = true score = score + 150 end ---when player kills enemy score 100, else remove 100 function collideEnemyWithPlatform(dx,dy,v,obj) if obj == player then if (player.t + player.h < v.t + 2) then EnemyDie(v) Score = score + 100 else Die() Score = score - 100 end end end We can now update the love.draw function to print the Life and Score on the screen: function love.draw() if gamestate == "playing" then love.graphics.print("Life:"..life, 32, 32) love.graphics.print("Score:"..score, 320, 32) love.graphics.setFont(medium) map:draw() DrawPlayer() DrawEnemy...