python - Image flickering in PyGame? -
i'm trying send "waves" of enemies code:
wavechooser = random.randint(1, 4) print wavechooser if wavechooser == 1: wave1()
but when run this, enemies send using wave1()
keep flickering. wave1()
code runs fine wihtout wavechooser, wavechooser comes problem.
i'm guessing because wavechooser
in while
statement, values of wavechooser
keep changing.
so question is, how keep enemy opaque? prefer not change if statement because want send multiple waves @ once.
wave1()
code:
def wave1(): global timer global timer1 global angle speed = random.uniform(0.1, 0.9) index = 0 # removing enemies enemy1 in enemies: if enemy1[0] < 330: enemy.pop(index) enemy1[0] -= speed index += 1 enemy1 in enemies: screen.blit(enemy, enemy1)
as said, part seems working fine individually.
edit: also, after send wave, can't seem able send one. need post more code? edit: of outputted values of wavechooser
3 4 3 4 3 2 4 1 3 3 3 4 3 1 2 4 3 1 2 4 1 3 2 3 2 3 4 2 2 1 1 4 3 2 4 2 4 2 3
Comments
Post a Comment