Where the hell is the syntax error???
My code is "init = function()
end
update = function()
end
draw = function()
end
screen.drawSprite( "icon", x, y, 16, 16 )
update = function()
if keyboard.A then x -= 2 end
if keyboard.D then x += 2 end
if keyboard.W then y += 2 end
if keyboard.S then y -= 2 end
if keyboard.S then y -= 2 end
end
for i=1 to ∞
YPos = y
end
for i=1 to ∞
XPos = x
end
for i=1 to 99
print(XPos)
end
for i=1 to 99
print(YPos)
end
"
And the error is at line 19 column 10
I found a couple of issues in your code.
First off, you placed a drawing function outside of draw
, which will unsurprisingly never render anything.
Second, anything placed outside of the three functions, such as the four for-loops, really will never be executed.
Third, you should NEVER, and I mean NEVER create an infinite loop, ESPECIALLY not like this.
And finally, please use the functions the engine has predefined, it makes everything a whole lot easier.
init = function()
x = 0
y = 0
end
update = function()
if keyboard.A then x -= 2
elsif keyboard.D then x += 2 end
if keyboard.W then y += 2
elsif keyboard.S then y -= 2 end
print(x)
print(y)
end
draw = function()
screen.drawSprite( "icon", x, y, 16, 16 )
end