1
0
Fork 0

Kill player when turtle is hit.

This commit is contained in:
Gonzalo Delgado 2023-08-23 08:13:38 -03:00
parent 4481ee4512
commit 36975cf72f
1 changed files with 3 additions and 3 deletions

View File

@ -53,6 +53,7 @@ local player = {
function resetPlayer()
player.pos = {x=t2p(0), y=t2p(0)}
player.dead = false
player.turtleHit = false
player.turtlePos = {x=t2p(0), y=t2p(1)}
end
@ -86,7 +87,7 @@ end
function love.keyreleased(key)
if player.dead then
if player.dead or player.turtleHit then
return
end
local newPos = screenPixelToTilePos(player.pos)
@ -138,8 +139,7 @@ function rectanglesIntersect(rect1, rect2)
end
function love.update(dt)
player.turtleHit = false
if player.dead then
if player.dead or player.turtleHit then
player.deadTimer = player.deadTimer - dt
if player.deadTimer <= 0 then
player.deadTimer = 2