Heres the code:
Code: Select all
function love.load()
mega = love.graphics.newImage("yoshi.png")
var = "Use WASD to move your character around!"
mario = love.graphics.newImage("mario.png")
charx = 200
chary = 100
mario = false
end
function love.update(dt)
function love.draw()
love.graphics.print(var,300,400)
if mario == false then
love.graphics.draw(mega,charx,chary,0,0.2,0.2)
elseif mario == true then
love.graphics.draw(mario,charx,chary)
end
end
if love.keyboard.isDown("w") then
chary = chary - 10
elseif love.keyboard.isDown("s") then
chary = chary + 10
end
if love.keyboard.isDown("a") then
charx = charx - 10
elseif love.keyboard.isDown("d") then
charx = charx + 10
end
function love.mousepressed(x,y,button)
if button == '1' then
mario = true
charx = x
chary = y
end
end
end