Compare commits

...

3 Commits

Author SHA1 Message Date
Gonzalo Delgado
65cf8bd968 Hide cars and logs drawing outside of playfield. 2023-09-01 07:37:52 -03:00
Gonzalo Delgado
3218c3b83c Kill player when floating off screen. 2023-09-01 07:30:13 -03:00
Gonzalo Delgado
fd058707f5 Update vehicle sprites. 2023-09-01 07:29:55 -03:00
2 changed files with 11 additions and 0 deletions

View File

@ -162,6 +162,13 @@ function love.update(dt)
if player.float_speed ~= 0 then if player.float_speed ~= 0 then
player.pos.y = player.pos.y + player.float_speed*dt player.pos.y = player.pos.y + player.float_speed*dt
player.turtlePos.y = player.turtlePos.y + player.float_speed*dt player.turtlePos.y = player.turtlePos.y + player.float_speed*dt
if playerRect.y > t2p(game.PLAYFIELD_HEIGHT) or playerRect.y + playerRect.h< t2p(0) then
player.dead = true
end
if turtleRect.y > t2p(game.PLAYFIELD_HEIGHT) or turtleRect.y + turtleRect.h< t2p(0) then
player.turtleHit = true
end
end end
for i, vehicle in ipairs(game.entities.vehicles) do for i, vehicle in ipairs(game.entities.vehicles) do
local colliderRect = {x=vehicle.x + vehicle.collider.x, y=vehicle.y + vehicle.collider.y, w=vehicle.collider.width, h=vehicle.collider.height} local colliderRect = {x=vehicle.x + vehicle.collider.x, y=vehicle.y + vehicle.collider.y, w=vehicle.collider.width, h=vehicle.collider.height}
@ -262,6 +269,10 @@ function love.draw()
else else
love.graphics.setColor(1, 1, 1) love.graphics.setColor(1, 1, 1)
end end
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", 16, -t2p(game.PLAYFIELD_OFFSET_TOP), game.SCREEN_WIDTH, t2p(game.PLAYFIELD_OFFSET_TOP))
love.graphics.rectangle("fill", 0, game.SCREEN_HEIGHT - 40, game.SCREEN_WIDTH, 48)
love.graphics.setColor(1, 1, 1)
local x, y = player.pos.x, player.pos.y local x, y = player.pos.x, player.pos.y
love.graphics.draw(player.sprites, player.quads.dude, x, y - 8) love.graphics.draw(player.sprites, player.quads.dude, x, y - 8)
x, y = player.turtlePos.x, player.turtlePos.y x, y = player.turtlePos.x, player.turtlePos.y

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB