pygame.draw.circle()

Sintassi

  • pygame.draw.circle(surface, color, center, radius, width=0, draw_top_right=None, draw_top_left=None, draw_bottom_left=None, draw_bottom_right=None)
  • pygame.draw.circle(surface, color, center, radius)
  • pygame.draw.circle(surface, color, center, radius, width)
  • pygame.draw.circle(surface, color, center, radius, draw_top_right=True)

Osserva

  1. Parametri obbligatori: superficie, colore, centro e raggio
  2. width=0, cerchio pieno
  3. width > 0, cerchio senza riempimento con tratto specificato
  4. Si può specificare quale quadrante (o arco) si vuole disegnare

Prova!

import pygame

CENTER1 = (200, 200)
CENTER2 = (500, 200)
CENTER3 = (300, 400)
CENTER4 = (600, 400)
COLORE  = (0, 255, 0)

pygame.init()
SCREEN=pygame.display.set_mode((800, 600))
pygame.display.set_caption("pygame.draw.circle()")

pygame.draw.circle(SCREEN, COLORE, CENTER1, 100                                                     )
pygame.draw.circle(SCREEN, COLORE, CENTER2, 100,          draw_top_right=True, draw_bottom_left=True)
pygame.draw.circle(SCREEN, COLORE, CENTER3, 100, width=5                                            )
pygame.draw.circle(SCREEN, COLORE, CENTER4, 100, width=5, draw_top_right=True, draw_bottom_left=True)

pygame.display.flip()

Lascia un commento