1. Powding for props
Put the props to set it to a custom time (support_time):
Put the props to set it to a custom time (support_time):
# Set up prop distribution as a custom event
Support_time = userevent
pygame.time.set_timer (SUPPLY_TIME, 30 * 1000) #Set the time interval of a custom event is 30 seconds
Em
In the cycle of the detection event:
#Trigger props supply event
event.type == support_time:
support_sound.play ()
if Choice ([True, FALSE]): #i i i i in true and false
bomb_supply.reset ()
else:
bullet_supply.reset ()
Em
1) Bomb:
# Draw a full -screen bomb supply and detect whether it is obtained
if bomb_supply.active:
bomb_supply.move ()
screen.blit (bomb_supply.image, bomb_supply.rect) #Draw bomb supply
if pygame.sprite.collide_mask (bomb_supply, me): #Directly detect bomb_supply, whether the two elves have collided
get_bomb_sound.play ()
if bomb_num <3: #If the original bomb was <= 3, you can get a bomb
bomb_num += 1
bomb_supply.active = False #After the bomb supply is obtained, the supply picture disappears
2) Super bullet
# Super Bullet timer (custom event)
Double_bullet_time_finish = userevent +
2. At the same time, the sound effects are also suspended at the same time
…
event detection cycle:
if Paised:# If the pause is paused, all the sound is suspended, and the supply event is suspended
pygame.time.set_timer (SUPPLY_TIME, 0) #If pause, the "supply event" custom event suspension occurs
pygame.mixer.music.pause ()#Background music pause
pygame.mixer.pause ()#sound effects
Else: #If it is not paused, all the sounds are played normally, and the supply event occurs normally
pygame.time.set_timer (support_time, 30 * 1000)
pygame.mixer.music.unpause ()
pygame.mixer.unpause ()