Okay, heres my code:
And my error:Code:-- Alien Crosshair Game Screen
-- Completally Coded by Mailas Gonrai
-- Most errors fixed by pjspeedy and yaustar
-- Colors
black = Color.new(0,0,0)
blue = Color.new(191, 255, 195)
yellow = Color.new(255, 255, 0, 200)
green=Color.new(0,255,0, 195)
white = Color.new(255,255,255)
red = Color.new(255,69,0, 195)
-- ETC Variables
displayTime = math.random(2,5)
counter = 0
speed = 1
offscreen = false
pad = Controls.read()
-- Functions
function RandomPoint()
end
math.randomseed(os.time())
-- Images
back = Image.load("./Images/back_game.png")
crosshair = Image.load("./Images/crosshair.png")
border = Image.load("./Images/game_border.png")
alienimage = Image.load("./Images/alien.png")
-- Music
Music.playFile("./Music/grmus.it")
-- Objects
Player = {}
Player.x = 208
Player.y = 112
alien = {}
alien.x = math.random(1,3)
alien.y = math.random (1,3)
alien = {x = 0, y = 200}
x_point = 23
y_point = 83
-- Health Equivelent Options
Player.health = 100
healthbar = {}
healthbar.y = 10
function movePlayer()
if pad:left() then
Player.x = Player.x - 4
end
if pad:right() then
Player.x = Player.x + 4
end
if pad:down() then
Player.y = Player.y + 4
end
if pad:up() then
Player.y = Player.y - 4
end
end
function perimeterSize()
if Player.x > 480 - 64 then
Player.x = 480 - 64
end
if Player.x < 0 then
Player.x = 0
end
if Player.y > 272 - 64 then
Player.y = 272 - 64
end
if Player.y < 0 then
Player.y = 0
end
end
-- THE LOOP!----------------------------------------------------------
while true do
screen:clear()
x_point = math.random(1,480)
y_point = math.random(1,272)
AlienMove()
if alien.x < x_point then
alien.x = alien.x + 2
end
if alien.x > x_point then
alien.x = alien.x - 2
end
if alien.y < y_point then
alien.y = alien.y + 2
end
if alien.y < y_point then
alien.y = alien.y - 2
end
if alien.x == x_point and alien.y == y_point then
RandomPoint()
end
counter = counter + 1
if counter >= displayTime then
alien.x = math.random(1,3)
alien.y = math.random (1,3)
end
if alien.x == 1 then
alien.x = 224
alien.y = 182
end
if alien.x == 2 then
alien.x = 60
alien.y = 132
end
if alien.x == 3 then
alien.x = 404
alien.y = 154
end
displayTime = math.random(500,2000)
counter = 0
end
screen:blit(0,0,back)
screen:blit(alien.x,alien.y,alienimage)
screen:blit(Player.x,Player.y,crosshair)
screen:blit(0,0,border)
screen:fillRect(320,240,Player.health,healthbar.y,green)
screen:print(320,230,Player.health,blue)
movePlayer()
perimeterSize()
alienscreenSize()
if pad:l() then
dofile("menu.lua")
end
screen.waitVblankStart()
screen.flip()
end
Zitat:
error: ./game.lua:159: /<eof>/ expected near /end/
