mardi 2 mai 2017

"if x or x" statement not running second condition in Python

I have an if statement in Python that looks like this:

if not hgbox.colliderect(landbox1) or not hgbox.colliderect(landbox2) and hgair == True:
    hgair = False
    hgbox.top += speed
    hgjumpallowed = False
if hgbox.colliderect(landbox1) or hgbox.colliderect(landbox2):
    hgjumpallowed = True
    stop()

However, when I run my script, hgbox doesn't detect collision with landbox2, and just keeps falling. I have found nothing wrong with the rest of my script, so I know that this is the problem, since I have seen this occur before. What should I do.

Aucun commentaire:

Enregistrer un commentaire