[ISSUE] "unexpected symbol near ="? #2090
suzukiception
started this conversation in
General
Replies: 2 comments 1 reply
-
38
|
Beta Was this translation helpful? Give feedback.
0 replies
-
This didn't solve the issue |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
so, i made this code:
game= {
width = 240,
height = 136,
scrollx= 0,
scrolly=0,
state = true
}
local barx,bary=game.width,
game.height
hero = {
x = game.width /10,
y = game.height /2,
width = 10,
height= 10,
direction= 0,
sprite= 0,
speed= 2,
point= function()
draw = function()
spr(
hero.sprite,
hero.x,
hero.y,
0,
2,
hero.direction,
0
)
end,
move = function()
if btn (0) and hero.y > 0
then hero.y = hero.y - hero.speed
hero.sprite=2
end
if btn (1) and hero.height < game.height
then hero.y = hero.y + hero.speed
hero.sprite=1
end
if btn (2) and hero.x > 0
then hero.x = hero.x - hero.speed
hero.direction = 1
hero.sprite=3
end
if btn (3) and hero.width < game.width
then hero.x = hero.x + hero.speed
hero.direction = 0
end
}
mouse(barx,bary,true,false,false,game.scrollx,game.scrolly)
barx=barx+scrollx
bary=bary+scrolly
if barx<1 then barx=1
end
if bary<1 then bary=1
end
enemy1 = {
x = game.width / 10*9,
y = game.height /2,
width = 10,
height= 10,
direction= 0,
sprite= 4,
speed= 1,
draw = function()
spr(
enemy1.sprite,
enemy1.x,
enemy1.y,
0,
2,
enemy1.direction,
0
)
end,
move = function()
if enemy1.x > hero.x then
enemy1.x = enemy1.x - enemy1.speed
enemy1.sprite = 13
end
if enemy1.x < hero.x then
enemy1.x = enemy1.x + enemy1.speed
enemy1.sprite= 4
end
if enemy1.y > hero.y then
enemy1.y= enemy1.y - enemy1.speed
enemy1.sprite = 11
end
if enemy1.y < hero.y then
enemy1.y= enemy1.y + enemy1.speed
enemy1.sprite = 12
end
end
}
function TIC()
cls(0)
if hero.x == enemy1.x and
hero.y == enemy1.x
game.state = false
if btn (1) then
game.state = true
end
map(game.width,
game.height,
30,
17,
0,
0,
0)
hero.draw()
enemy1.draw()
if game.state then
hero.move()
enemy1.move()
else
local msg_endgame= "Game Over"
local width_msg=print(msg_continue,0,-6
print (msg_endgame,(game.width-width_msg)//2, (game.height-6)//2)
end
end
and when try to run it, this error appears to me:
[string "-- title: game
title..."]:39: unexpected symbol near
'='
what did i do wrong and how can i solve it?
Beta Was this translation helpful? Give feedback.
All reactions