Example: Collision Callbacks and Triggers
player.body:setLinearVelocity(math.max(velocity.x,
-
player.maxvelocity), velocity.y)
end
end
function love.draw()
if not endgame then
love.graphics.setColor(1,1,1)
love.graphics.polygon("fill", player.body:getWorldPoints(
player.shape:getPoints()))
love.graphics.setColor(0,1,0)
love.graphics.polygon("fill", ground.body:getWorldPoints(
ground.shape:getPoints()))
love.graphics.polygon("fill", platform1.body:getWorldPoints(
platform1.shape:getPoints()))
love.graphics.setColor(0,0,1)
love.graphics.polygon("fill", trigger1.body:getWorldPoints(
trigger1.shape:getPoints()))
else
love.graphics.setColor(1,1,1)
love.graphics.print("Game Completed!", 350, 300)
end
end