Discord
Login
Community
DARK THEME

If then statement won't activate even if statement is true

//collision

colliding=((spriteCollision("thing", "pipetop")) != 0)

colliding2=((spriteCollision("thing", "pipebottom")) != 0)

screen.drawText((colliding), 120, 80, 20, "black")

screen.drawText((colliding2), 120, 60, 20, "black")

if colliding != 0 or colliding2 != 0

then

screen.drawSprite("log"-180, 80, 30, 30)

system.exit

end

And I know for a fact that its true because I have the variables showing in the code above

You're missing a comma in line

screen.drawSprite("log"-180, 80, 30, 30)

Should be

screen.drawSprite("log", -180, 80, 30, 30)

Is this a typo in the post, or from your code?

edit:

Also, correct call of exit is system.exit() - with parenthesis.

But system.exit() ends the game right away and all you would see is a black screen ... ?

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community