I have a running game where you can move and collect coins. For each coin I have a if statement:
if cn1+25 < x and cn1 + 50 > x:
cn1 = -1000
It is also possible to use a tuple to run an if
statement only once.
by creating the tuple switch = [0]
out side of the while
loop then this peace of code can suffice.
if Your conditions:
if switch[0] == 0:
switch[0] += 1
all that you need from here is something that runs (or doesn't) because switch[0] = 1
. By having it only add up to 1 you could add a similar peace of code to undo.