Error?
Posted: Sun Jul 27, 2014 4:57 pm
My window says main.lua:11: attempt to index global 'ents' (a nil value)
my code is:
my code is:
Code: Select all
function love.load()
require ("entities")
ents.Startup()
love.graphics.setBackgroundColor( 255, 255, 255 )
xCloud = 0
imageCloud = love.graphics.newImage("textures/cloud.png")
end
for i = 1, 8 do
ents.Create( "moon", -math.random(128, 256), 128 )
end
function love.draw()
local x = love.mouse.getX( )
local y = love.mouse.getY( )
love.graphics.setColor( 153, 217, 234, 255 )
love.graphics.rectangle( "fill", 0, 0, 800, 300 )
love.graphics.setColor( 255, 255, 255, 255 )
love.graphics.draw( imageCloud, xCloud - 256, 128, 0, 1, 1, 0, 0 )
love.graphics.setColor( 103, 164, 21, 255 )
love.graphics.rectangle( "fill", 0, 300, 800, 300 )
ents:draw()
end
function love.update(dt)
xCloud = xCloud + 32*dt
if xCloud >= (800 + 256) then
xCloud = 0
end
ent:update(dt)
end
function love.focus(bool)
end
function love.keypressed( key, unicode )
print ("You just pressed " .. key)
end
function love.keyreleased( key, unicode )
print ("You just released " .. key)
end
function love.mousepressed( x, y, button )
end
function love.mousereleased( x, y, button )
end
function love.quit()
end