Figuras Pygame

Mi figura en pygame:

import pygame
import random
AZULCIELO = (182, 242, 234)
BLANCO = (255, 255, 255)
pygame.init()
running = True
window = pygame.display.set_mode( (600,500) )
blanco = pygame.Color(100,100,100)
window.fill((blanco))
def dibujar_lluvia(pantalla, limites, listaPuntos):
for i in range(len(listaPuntos)):
r = listaPuntos[i][2]
x = listaPuntos[i][0]
y = listaPuntos[i][1]
pygame.draw.circle(pantalla, BLANCO, [x, y], r, 0)
listaPuntos[i][1] += 1
if listaPuntos[i][1] > limites[1]:
y = random.randrange(-50, -10)
listaPuntos[i][1] = y
x = random.randrange(50, limites[0])
listaPuntos[i][0] = x
def crearPuntosAletorios(cantidad, rangos):
listaPuntos = []
for i in range(cantidad):
radio = 1
x = random.randrange(1, 600)
y = random.randrange(0, 400)
listaPuntos.append([x, y, radio])
return listaPuntos
listaPuntos = crearPuntosAletorios(30, [600, 400])
reloj = pygame.time.Clock()
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
contorno=(255, 201, 20)
alita=(255, 159, 4)
ojito=(0,0,0)
piquto=(255, 159, 4)
agua=(34, 216, 207)
arena=(255, 250, 112)
conchita=(255, 136, 195)
cuerpopez=(38, 130, 180)
aletaspez=(249, 142, 169)
pygame.draw.rect(window, AZULCIELO, (0,0, 600, 400))
dibujar_lluvia(window, [600, 400], listaPuntos)
# contorno
pygame.draw.polygon(window, contorno, [(92,30),(148,30),(174, 84),(148,110),(200, 110),(229, 140),(255,113),
(255,193),(229,220),(92, 220),(65,194),(65, 140),(90, 112), (66,86),(66,58)],0)
# Alita
pygame.draw.line(window,alita,(120, 140),(120, 166),4)
pygame.draw.line(window, alita, (120, 166), (146, 194), 4)
pygame.draw.line(window, alita, (146, 194), (201, 194), 4)
pygame.draw.line(window, alita, (201, 193), (227, 166), 4)
pygame.draw.line(window, alita, (227, 166), (202, 140), 4)
pygame.draw.line(window, alita, (202, 140), (172, 140), 4)
# Ojito
pygame.draw.ellipse(window,ojito,(94, 72, 15,15),0)
# Piquito
pygame.draw.polygon(window,piquto,[(66, 86), (90, 112), (40, 112)],0)
# Agua
pygame.draw.rect(window,agua,(0, 220, 600, 440),0)
# Arena
pygame.draw.rect(window,arena,(0, 438, 600, 520,),0)
# conchita
pygame.draw.polygon(window,conchita,[(249, 420),(285,420),(302,438),(304,458),(266,475),(254,476),(248, 472)], 0)
pygame.draw.polygon(window,conchita,[(266, 475),(254,476),(266,482)],0)
pygame.draw.polygon(window,conchita,[(254, 476),(248,460),(242, 466)],0)
# cuerpo pescadito
pygame.draw.polygon(window,cuerpopez,[(31,290),(42,302),(60, 308),(74,318),(88,333),(88,348),(73,348),(45,333),(43,330),
(37, 319),(31,305)],0)
#ojitos pescadito
pygame.draw.ellipse(window,ojito,(74,330,5,5),0)
#aletas pescadito
pygame.draw.polygon(window,aletaspez,[(60, 308), (60, 290), (74, 305), (74, 318)],0)
pygame.draw.polygon(window,aletaspez,[(59, 333), (45, 348), (45, 333)],0)
pygame.draw.polygon(window,aletaspez,[(37, 319), (29, 319), (15, 305),(31, 305)],0)
# cola pescadito
pygame.draw.polygon(window,aletaspez,[(31, 290), (30, 275), (45, 260), (44, 275), (59, 275)],0 )
pygame.display.flip()
reloj.tick(60)
view raw pollitopygam.py hosted with ❤ by GitHub

Cara de perrito pygame:

import pygame
import time
pygame.init()
running = True
window = pygame.display.set_mode( (1150, 1150) )
amarillo = pygame.Color(244,180,0)
window.fill((amarillo))
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
cara=(139, 130, 0)
orejas=(139, 130, 85)
menton=(255, 78, 0)
ojos=(0,0,0)
nariz=(0, 0, 0)
pygame.draw.polygon(window,cara,[(415, 50), (235, 490), (365, 625), (755, 625), (850, 500), (700, 50)],0)
# orejas
pygame.draw.polygon(window,orejas,[(415, 50), (60, 320), (175, 635)],0)
pygame.draw.polygon(window,orejas,[(700, 50), (1045, 320), (896, 635)],0)
# menton
pygame.draw.polygon(window,menton,[(365, 625), (550, 415), (755, 625)],0)
# ojos
pygame.draw.ellipse(window,ojos,(420, 225,90, 90),0)
pygame.draw.ellipse(window,ojos,(630, 225,90, 90),0)
# bigotes
pygame.draw.ellipse(window,nariz,(475, 525, 20, 20),0)
pygame.draw.ellipse(window,nariz,(615, 525, 20, 20), 0)
pygame.draw.ellipse(window,nariz,(445, 560, 20, 20),0)
pygame.draw.ellipse(window,nariz,(610, 560, 20, 20),0)
pygame.draw.ellipse(window,nariz,(480, 560, 20, 20),0)
pygame.draw.ellipse(window,nariz,(640, 560, 20, 20),0)
# nariz
pygame.draw.ellipse(window,nariz,(470, 305, 150, 150),0)
pygame.display.update()

Deja un comentario

Diseña un sitio como este con WordPress.com
Comenzar