Unexpected <eof> near End
Posted: Sun May 31, 2015 6:55 am
I'm trying to make a basic tracking AI that follows the player's y axis and approaches them, then I came across this error, I don't know what's caused it. The code for the AI is below, as well as the code other entities incase they're screwing with it somehow. (This is my first game, so be ready for poorly written code.) This is the entire main.lua . Here's a picture of the error. https://i.imgur.com/uK16U5x.png
edit: forgot to mention, I'm going to go to sleep, so I'll look at this when I wake up.
Code: Select all
debug = true
player = { x = 10, y = 560, xSpeed = 450, ySpeed = 700, img = nil, Img2 = nil }
player2 = { x = 1270, y = 560, xSpeed = 450, ySpeed = 700, img = nil, Img2 = nil }
bullet = { x = 640, y = 360, xSpeed = 300, ySpeed = 450, img = nil, Img2 = nil }
function love.draw(dt)
love.graphics.draw(player.Img, player.x, player.y)
love.graphics.draw(player2.Img, player2.x, player2.y)
love.graphics.draw(bullet.Img, bullet.x, bullet.y)
end
function love.load(arg)
player.Img = love.graphics.newImage('assets/player 1.png')
player.Img2 = love.graphics.newImage('assets/player 1 flip.png')
player2.Img = love.graphics.newImage('assets/player 2.png')
player2.Img2 = love.graphics.newImage('assets/player 2 flip.png')
bullet.Img = love.graphics.newImage('assets/bullet.png')
bullet.Img2 = love.graphics.newImage('assets/bullet flip.png')
-- asset ready to be used
end
function love.update(dt)
-- basic menu stuff
if love.keyboard.isDown('escape') then
love.event.push('quit')
end
-- player 1
if love.keyboard.isDown('w') then
if player.y > 0 then
player.y = player.y - (player.ySpeed*dt)
end
elseif love.keyboard.isDown('s') then
if player.y < (love.graphics.getHeight() - player.Img:getHeight()) then
player.y = player.y + (player.ySpeed*dt)
end
end
---------------------------------------------------------------------------------------------------------------------------------------
-- AI
---------------------------------------------------------------------------------------------------------------------------------------
-- Bullet AI
if love.keyboard.isDown(' ') then
if player.y >= 360 then
bullet.y = player.y - (bullet.ySpeed*dt)
elseif player.y < 360 then
bullet.y = player.y + (bullet.ySpeed*dt)
end
end
end
end
---------------------------------------------------------------------------------------------------------------------------------------
end