-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimationImage.py
More file actions
122 lines (96 loc) · 3.87 KB
/
Copy pathanimationImage.py
File metadata and controls
122 lines (96 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import pygame
NEGRO = ( 0, 0, 0)
BLANCO = ( 255, 255, 255)
VERDE = ( 0, 255, 0)
ROJO = ( 255, 0, 0)
MARRON = ( 219,139, 9)
MARRONCLARO = ( 186,173,32 )
ASUL = ( 191,242,240)
AMARILLO = ( 237,229,7 )
VERDEPASTO = ( 22,189,4 )
VIOLETA = ( 98 , 0,255)
pygame.init()
tamano = (800, 900)
pantalla = pygame.display.set_mode(tamano)
pygame.display.set_caption("Mi dibujo")
terminar = False
reloj = pygame.time.Clock()
movete_oja = 0
buelve = 1
altura = 0
alturalimite = -1
muevetenube = 0
nubeincremento = 1
bajanuve = 1
alturanuve = 0
inclementonube2 = 1
tiemposemaforo = 0
incrementocemaforo = 1
while not terminar:
for evento in pygame.event.get():
if evento.type == pygame.QUIT:
terminar = True
pantalla.fill(BLANCO)
pygame.draw.rect(pantalla, ASUL , [0,0,800,800] )
pygame.draw.ellipse(pantalla,AMARILLO,[670,-60,200,200])
for nubes in range(1,800,200):
pygame.draw.ellipse(pantalla,BLANCO,[580-nubes + muevetenube*2,50 + alturanuve ,100 ,101])#nubes
pygame.draw.ellipse(pantalla,BLANCO,[625-nubes + muevetenube*2,50 + alturanuve ,100,100])
pygame.draw.ellipse(pantalla,BLANCO,[600-nubes + muevetenube*2,130 + alturanuve ,107,100])
pygame.draw.ellipse(pantalla,BLANCO,[635-nubes + muevetenube*2,100 + alturanuve,100,90])
pygame.draw.ellipse(pantalla,BLANCO,[560-nubes + muevetenube*2,100 + alturanuve ,100,90])
pygame.draw.ellipse(pantalla,BLANCO,[600,90,50,50])
pygame.draw.ellipse(pantalla,BLANCO,[625-nubes,50,100,100])
pygame.draw.ellipse(pantalla,BLANCO,[500-nubes,50,100,90])
pygame.draw.ellipse(pantalla,BLANCO,[635-nubes,100,90,90])
pygame.draw.ellipse(pantalla,BLANCO,[560-nubes,100,90,90])
alturanuve += inclementonube2
muevetenube += nubeincremento
if muevetenube == 50:
nubeincremento = -1
bajanuve = -1
elif muevetenube == -60:
nubeincremento = 1
bajanuve = 1
if alturanuve == 44:
inclementonube2 = -1
elif alturanuve == -40:
inclementonube2 = 1
pygame.draw.rect(pantalla, MARRON , [80,180,500,600])
for pelomoviendoce in range(0,520,20):
pygame.draw.line(pantalla, MARRONCLARO, [80+pelomoviendoce,180], [80+pelomoviendoce,780], 6)#cabellos
pygame.draw.polygon(pantalla,ROJO,[[330,0],[582,180],[77,180]])
pygame.draw.rect(pantalla, MARRON, [135,270,130,150],16)
pygame.draw.rect(pantalla, BLANCO, [135,270,130,150])
pygame.draw.rect(pantalla, MARRON, [380,270,130,150],16 )
pygame.draw.rect(pantalla,BLANCO , [380,270,130,150])
if tiemposemaforo < 15:
pygame.draw.rect(pantalla,NEGRO , [380,270,130,150])
elif tiemposemaforo > 30:
pygame.draw.rect(pantalla,NEGRO , [380,270,130,150])
if tiemposemaforo == 90:
incrementocemaforo = -1
elif tiemposemaforo == 0:
incrementocemaforo = 1
tiemposemaforo += incrementocemaforo
pygame.draw.rect(pantalla, MARRONCLARO, [166+80,480,150,300])
pygame.draw.rect(pantalla, MARRON , [246,480,150,300],5)
pygame.draw.rect(pantalla, VERDEPASTO, [0,780,800,110] )
for repeticion in range (0,750,30):
pcirculox = (10 + movete_oja ) + repeticion
pcirculoy = 800 + altura
pygame.draw.line(pantalla, VERDE , [pcirculox , pcirculoy ], [50 + repeticion ,850], 5)
pygame.draw.ellipse(pantalla,VIOLETA,[pcirculox -10 , pcirculoy -10 ,20,20])
movete_oja += buelve
altura += alturalimite
if movete_oja == 80:
buelve = - 1
elif movete_oja == -1:
buelve = 1
if altura == -10:
alturalimite = 2
elif altura == 20:
alturalimite = -2
pygame.display.flip()
reloj.tick(20)
pygame.quit()