PygameForBeginners icon indicating copy to clipboard operation
PygameForBeginners copied to clipboard

bullets are not showing

Open Deeptineeharika opened this issue 1 year ago • 2 comments

Deeptineeharika avatar Mar 30 '24 11:03 Deeptineeharika

same

Chirag1147933 avatar Apr 26 '24 17:04 Chirag1147933

i got it i was checking for event.type in bullet keys. here is the fixed code -

Inside the event loop for detecting bullet firing keys

if event.type == pygame.KEYDOWN: `` if event.key == pygame.K_f and len(yellow_bullets) < MAX_BULLETS: bullet = pygame.Rect(yellow.x + yellow.width, yellow.y + yellow.height//2,10,5) yellow_bullets.append(bullet)

if event.key == pygame.K_e and len(red_bullets) < MAX_BULLETS:
    bullet = pygame.Rect(red.x, red.y + red.height//2,10,5)
    red_bullets.append(bullet)

notice i have replaced event.type to event.keys and sorry for wrong spaces, it is a git hub issue

Chirag1147933 avatar Apr 26 '24 17:04 Chirag1147933