File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ # http://ocw.cs.pub.ro/courses/programare/laboratoare/python#exercitii
2
+
3
+ import pygame
4
+ from pygame .locals import *
5
+
6
+ w_size = 400
7
+ h_size = 400
8
+ screen = pygame .display .set_mode ((w_size , h_size ), DOUBLEBUF )
9
+
10
+ blue_color = (0 , 0 , 255 )
11
+ black_color = (0 , 0 , 0 )
12
+ p_x = 10
13
+ p_y = 200
14
+ radius = 20
15
+
16
+ running = True
17
+ increment = False
18
+ while running :
19
+ for event in pygame .event .get ():
20
+ if event .type == pygame .QUIT :
21
+ running = False
22
+ if event .type == KEYDOWN :
23
+ if event .key == K_RIGHT :
24
+ increment = True
25
+
26
+ if increment :
27
+ p_x = p_x + 1
28
+
29
+ position = [p_x , p_y ]
30
+
31
+ screen .fill (black_color )
32
+ pygame .draw .circle (screen , blue_color , position , radius )
33
+ pygame .display .flip ()
34
+
35
+ pygame .quit ()
You can’t perform that action at this time.
0 commit comments