Log In  

Hello! I'm not sure where to put this? But...I am getting this error and i'm not sure what's wrong?

Syntac error line 24 (tab 0)
If poison=9 then poisoned=true end

'Then' expected near '='

Here is my code I am working on...

function _init()
sprite=1
stimer=0
last_frame=4
first_frame=1

table={} --example
coin=false --example
string="dragon",23,"fist"
-- example

x1=25
y1=0

x2=50
y2=5
hcolor=8

poisoned=false
poison=0
end

function _update()
if poison<=9 then poison+=1 end
if poison=9 then poisoned=true end
if posioned=true then y1=y1-10 end

--if stimer<=7 then
--stimer+=1
--else
--if sprite<=last_frame then
--sprite+=first_frame
--else
--sprite=first_frame
--end
--stimer=0
--end

function _draw()
cls()
spr(sprite,64,64)

rectfill(x1,y1,x2,5,hcolor)
rect(x1,y1,x2,y2,7)--20,5,7
print("health",0,1,7)
--health bar combo

rectfill(50,15,30,10,10)
rect(50,15,30,10,7)--20,5,7
print("stamina",0,10,7)
--stamina bar combo!!!
end

Note: I commented out the animation code to attempt to debug the problem but, I am at a loss.

This is code based on following the tutorial's by spacecat.

P#131348 2023-06-26 12:58 ( Edited 2023-06-26 13:02)

You're missing an = sign:

if poison=9 then poisoned=true end

should be

if poison==9 then poisoned=true end

When you're checking for an equality condition, you have to use == rather than =

P#131349 2023-06-26 13:08

[Please log in to post a comment]