-1

Im trying to color a rect of a bullet, but for some reason the color isn't updating. the red_bullets and yellow_bullets are lists. here is the code:

import pygame

red_bullets = []
yellow_bullets = []

RED = (255, 0, 0)
YELLOW = (255, 255, 0)

def draw_window(red_bullets, yellow_bullets):
    for bullet in red_bullets:
        pygame.draw.rect(WIN, RED, bullet)

    for bullet in yellow_bullets:
        pygame.draw.rect(WIN, YELLOW, bullet)
    pygame.display.update()
def main():
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    draw_window(red_bullets, yellow_bullets)

   pygame.quit()

if __name__ == "__main__:
    main()
  • What is `yellow_bullets` and `red_bullets`? This code works fine when`yellow_bullets` and `red_bullets` are proper set correctly. – Rabbid76 Feb 28 '21 at 15:44
  • it's a list, ``` red_bullets = [] yellow_bullets = [] ``` – DiamondWolfCode Feb 28 '21 at 15:46
  • 1
    If the lists are empty, nothing is drawn at all. Where is the rectangle which you want to draw? Please read [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). – Rabbid76 Feb 28 '21 at 15:52

0 Answers0