I keep getting the same syntax error when trying to run my game. I don't know if I'm missing something or not.
the code is:
if btn(x button) and p1.landed=true then
p1.y-p1.boost
p1.landed=false
p1.jumping=true
end
It kept giving me the error 'then' expected near '='
You need to use "==" (two equals signs) for comparisons. One equals sign is only used for assigning a value to a variable.
So your code needs to be:
if btn(x button) and p1.landed == true then p1.y-p1.boost p1.landed=false p1.jumping=true end |
Also "p1.y-p1.boost" should probably be "p1.y -= p1.boost" (subtract p1.boost from p1.y, updating p1.y)
my error is
elseif player.sliding then
player.sp=65
and it says then expected near =
and when i try ==, it says that it's a syntax error
@yeeyer you should probably open your own new support thread instead of reviving a 4.5 year old thread. Would also be helpful if you post more of your code, what you've given here isn't enough to provide any help.
[Please log in to post a comment]