intdesjam_misc/main.lua

35 lines
1.1 KiB
Lua

local plat = require "plat"
local system = plat.PlatformSystem.new()
system:addPlatform(300, 400, 200, 50)
system:addPlatform(300, 300, 050, 200)
system:addPlatform(300, 100, 200, 50)
system:addPlatform(600, 100, 25, 25)
local player = system:addPlayer((800-50)/2, 250, 50, 50, {jump = 'up', left = 'left', right = 'right'})
player.color = {200, 255, 200}
player.dy = -100
--------------------------------------------------------------------------------
function love.update (dt)
system:update(dt)
end
function love.mousepressed (mx, my)
local my = my + player.y - (800-50)/2
system:addPlatform(mx, my, 100, 50)
end
function love.draw ()
system:draw(player.x, player.y - (800-50)/2)
local mx, my = love.mouse.getPosition()
my = my + player.y - (800-50)/2
love.graphics.setColor(255, 255, 255)
love.graphics.print('Mouse: (x, y) = (' .. mx .. ', ' .. my .. ')', 10, 10)
love.graphics.setColor(system:isPointOccupied(mx, my) and {255, 0, 0} or {0, 255, 0})
love.graphics.circle('fill', 10, 40, 5)
end