File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ import pygame
2+
3+ pygame .init ()
4+
5+ display_width = 800
6+ display_height = 600
7+
8+ black = (0 ,0 ,0 )
9+ white = (255 ,255 ,255 )
10+ red = (255 ,0 ,0 )
11+
12+ gameDisplay = pygame .display .set_mode ((display_width ,display_height ))
13+ pygame .display .set_caption ('A bit Racey' )
14+ clock = pygame .time .Clock ()
15+
16+ carImg = pygame .image .load ('racecar.png' )
17+
18+ def car (x ,y ):
19+ gameDisplay .blit (carImg ,(x ,y ))
20+
21+
22+ x = (display_width * 0.45 )
23+ y = (display_height * 0.8 )
24+
25+
26+ crashed = False
27+
28+ while not crashed :
29+
30+ for event in pygame .event .get ():
31+ if event .type == pygame .QUIT :
32+ crashed = True
33+
34+
35+ gameDisplay .fill (white )
36+ car (x ,y )
37+
38+ pygame .display .update ()
39+ clock .tick (60 )
40+
41+ pygame .quit ()
42+ quit ()
You can’t perform that action at this time.
0 commit comments