I'm trying to send "waves" of enemies with this code:
wavechooser = random.randint(1, 4)
print wavechooser
if wavechooser == 1:
wave1()
But when I run this, the enemies that I send using wave1() keep flickering.
My wave1() code runs fine wihtout the wavechooser, but with the wavechooser comes the problem.
I'm guessing this is because wavechooser is in a while statement, so the values of wavechooser keep changing.
So my question is, how would I keep the enemy opaque? I would prefer to not change the if statement because I want to send multiple waves at once.
wave1() code:
def wave1():
global timer
global timer1
global angle
speed = random.uniform(0.1, 0.9)
index = 0
# removing enemies
for enemy1 in enemies:
if enemy1[0] < 330:
enemy.pop(index)
enemy1[0] -= speed
index += 1
for enemy1 in enemies:
screen.blit(enemy, enemy1)
As I said, this part seems to be working fine individually.
EDIT: Also, after I send a wave, I can't seem to be able to send another one.
Do I need to post more code?
EDIT: Some of the 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