File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 3
3
pygame .init ()
4
4
5
5
size = width , height = 620 , 540
6
- speed1 = [1.5 , 1.5 ]
6
+ speed1 = [2 , 2 ]
7
7
speed2 = [1 , 1 ]
8
8
black = 0 , 0 , 0
9
9
10
10
screen = pygame .display .set_mode (size )
11
+ pygame .display .set_caption ("Bouncing Beach Balls" )
11
12
12
13
img1 = pygame .image .load ("ball1.png" )
13
14
img2 = pygame .image .load ("ball2.png" )
28
29
speed1 [0 ] = - speed1 [0 ]
29
30
if ballrect1 .top < 0 or ballrect1 .bottom > height :
30
31
speed1 [1 ] = - speed1 [1 ]
32
+
31
33
if ballrect2 .left < 0 or ballrect2 .right > width :
32
34
speed2 [0 ] = - speed2 [0 ]
33
35
if ballrect2 .top < 0 or ballrect2 .bottom > height :
34
36
speed2 [1 ] = - speed2 [1 ]
35
37
36
38
screen .fill (black )
37
39
38
- screen .blit (ball1 , ballrect1 , ball2 , ballrect2 )
40
+ screen .blit (ball1 , ballrect1 )
41
+ pygame .display .flip ()
42
+
43
+ screen .blit (ball2 , ballrect2 )
44
+ pygame .display .flip ()
39
45
40
- pygame .display .flip ()
You can’t perform that action at this time.
0 commit comments