Kill player when turtle is hit.
This commit is contained in:
parent
4481ee4512
commit
36975cf72f
6
main.lua
6
main.lua
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user