This is my main.lua
Code: Select all
function love.load()
love.graphics.setBackgroundColor(255, 255, 255)
character = love.graphics.newImage("character.png")
x = 200
y = 200
end
function love.update(dt)
end
function love.draw()
love.graphics.setFont(54)
love.graphics.setColor(0, 255, 255)
love.graphics.print("Start!:D", 5, 240)
end
function love.mousepressed(x,y)
if x > 5 and
x < 400 and
y > 240 and
y < 400 then require "lvl1/data001.lua"
end
end
Code: Select all
function love.update(dt)
if love.keyboard.isDown("w") then
y = y - 5
elseif love.keyboard.isDown("s") then
y = y + 5
end
if love.keyboard.isDown("a") then
x = x - 5
elseif love.keyboard.isDown("d") then
x = x + 5
end
if x < 0 then
x = 799
end
if y > 600 then
y = 0
end
if y < 0 then
y = 599
end
if x > 800 then
require "lvl1/data002.lua"
end
end
function love.draw()
love.graphics.setBackgroundColor(255, 255, 255)
love.graphics.setColor(255, 255, 255)
love.graphics.draw(character, x, y)
love.graphics.setFont(58)
love.graphics.setColor(0, 255, 255)
love.graphics.print("Use WASD To Move!:D", 10, 5)
end