------------------------------------------------------------------------------
Error
main.lua:89: Incorrect parameter type: expected userdata.
Traceback
[C]: in function 'draw'
main.lua:89: in function 'draw'
[C]: in function 'xpcall'
-----------------------------------------------------------------------------------
Whats userdata? Help would be great
here's my code:
main.lua:
Code: Select all
require "player"
function love.load()
player = love.graphics.newImage("assets/player.png")
playerx = 270
playery = 420
-- music
music = love.audio.newSource( "assets/music.ogg" , "steam")
music:setLooping(true)
love.audio.play(music)
Cloudx = 0
yCloud = 128
cloudimage = ("assets/cloud.gif")
bullet = ("assets/bullet.gif")
end
function love.update(dt)
Cloudx = Cloudx + 32*dt
if Cloudx >= (900 + 278) then
Cloudx = 0
end
if love.keyboard.isDown("d") then
playerx = playerx + 275*dt
player = love.graphics.newImage("assets/player.png")
end
if love.keyboard.isDown("s") then
playery = playery + 675*dt
end
if love.keyboard.isDown("a") then
player = love.graphics.newImage("assets/playerback.png")
playerx = playerx - 275*dt
end
if playery > 420 then
playery = 420
end
end
function love.draw()
love.graphics.setColor(40,255,40)
love.graphics.rectangle("fill",
0,0,love.graphics.getWidth(),love.graphics.getHeight())
love.graphics.setColor(255,255,255)
love.graphics.setColor(111,183,255)
love.graphics.rectangle("fill",0,0,love.graphics.getWidth(),450)
love.graphics.setColor(255,255,255)
love.graphics.draw(cloudimage, Cloudx - 278, 128,278)
love.graphics.draw(player, playerx, playery)
end
Code: Select all
playerxy = {}
x = 0
y = 0