player = {x = 200, y = 710, speed = 150, img = nil}
function love.load(arg)
player = love.graphics.newImage('assets/ship.png')
end
function love.update(dt)
if love.keyboard.isDown('escape') then
love.event.push('quit')
end
if love.keyboard.isDown('left') then
player.x = player.x - (player.speed*dt)
end
end
function love.draw(dt)
love.graphics.draw (player, 100,100)
end
In love.load you are loading your image into the "player" table, which means it no longer has the attributes you defined on the first line.
Edit:
Should be
player = {x = 200, y = 710, speed = 150, img = nil}
function love.load(arg)
player = love.graphics.newImage('assets/ship.png')
end
function love.update(dt)
if love.keyboard.isDown('escape') then
love.event.push('quit')
end
if love.keyboard.isDown('left') then
player.x = player.x - (player.speed*dt)
end
end
function love.draw(dt)
love.graphics.draw (player, 100,100)
end
You are overwriting the player table in love.load:
player = love.graphics.newImage('assets/ship.png')
Instead assign to player.sprite or something like that, then also change your drawing code.
BTW your love.draw always draws to 100,100 - you probably want player.x, player.y instead there.