Home > other >  Adaptation of py tanks war game met bug! For help!
Adaptation of py tanks war game met bug! For help!

Time:10-08

Combined with disease resistance theme, adapted to the virus war game, you can run, but there are a few problems:
One, at the start of the virus is normal, after the second bullet can only destroy viruses, and cannot attack players;
Second, the player can't eat food
Also, every brother please can you take time to help!
 # main loop 
While not is_gameover:
# levels
Stage +=1
If stage & gt; Num_stage:
Break
Show_switch_stage (screen, 3, 3, stage)
Enemies_total=min (stage * 18, 80)
Enemies_now=0
Enemies_now_max=min (Max (stage * 2, 4), 8)
WarriorsGroup=pygame. Sprite. Group ()
MywarriorsGroup=pygame. Sprite. Group ()
EnemiesGroup=pygame. Sprite. Group ()
BulletsGroup=pygame. Sprite. Group ()
MybulletsGroup=pygame. Sprite. Group ()
EnemybulletsGroup=pygame. Sprite. Group ()
MyfoodsGroup=pygame. Sprite. Group ()
# custom events
GenEnemyEvent=pygame. Constants. USEREVENT
Pygame. Time. Set_timer genEnemyEvent, (100)
RecoverEnemyEvent=pygame. Constants. USEREVENT
Pygame. Time. Set_timer recoverEnemyEvent, (8000)
NoprotectWarriorEvent=pygame. Constants. USEREVENT
Pygame. Time. Set_timer noprotectWarriorEvent, (8000)
Map_stage=scene. The Map (stage)
Warrior_player1=warriors. Warrior (1)
WarriorsGroup. Add (warrior_player1)
WarriorsGroup. Add (warrior_player1)
If num_player & gt; 1:
Warrior_player2=warriors. Warrior (2)
WarriorsGroup. Add (warrior_player2)
WarriorsGroup. Add (warrior_player2)
Is_switch_warrior=True
Player1_moving=False
Player2_moving=False
Time=0
# enemy virus
For I in range (0, 3) :
If enemies_total & gt; 0:
Enemy=enemies. Enemy (I)
EnemiesGroup. Add (enemy)
EnemiesGroup. Add (enemy)
Enemies_now +=1
Enemies_total -=1
Myhome=home. Home ()
# for special effects
Appearance_img=pygame. Image. The load ("./images/others/appear. PNG "). The convert_alpha ()
Appearances=[]
Appearances. Append (appearance_img. Subsurface ((0, 0), (48, 48)))
Appearances. Append (appearance_img. Subsurface ((48, 0), (48, 48)))
Appearances. Append (appearance_img. Subsurface ((96, 0), (48, 48)))

  • Related