Compare commits
3 Commits
571849a9ad
...
65cf8bd968
Author | SHA1 | Date | |
---|---|---|---|
|
65cf8bd968 | ||
|
3218c3b83c | ||
|
fd058707f5 |
11
main.lua
11
main.lua
@ -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
|
||||||
|
BIN
sprites.png
BIN
sprites.png
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in New Issue
Block a user