-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFastClick.py
More file actions
600 lines (475 loc) · 23.5 KB
/
FastClick.py
File metadata and controls
600 lines (475 loc) · 23.5 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
import pygame
import random
import os
import shutil
import csv
# Créez la classe Score
class ScoreClass:
def __init__(self, nom, scoreh):
self.nom = nom
self.scoreh = scoreh
# Créez la classe ScoreReader
class ScoreReader:
def __init__(self, chemin_fichier):
self.chemin_fichier = chemin_fichier
def lirehighscores(self):
liste_highscore = []
with open(self.chemin_fichier, mode='r', encoding='utf-8') as fichier_csv:
reader = csv.DictReader(fichier_csv)
for ligne in reader:
nom = ligne["Nom"]
scoreh = ligne["Highscore"]
highscore = ScoreClass(nom, scoreh)
liste_highscore.append(highscore)
return liste_highscore
def lirehighscores(self):
liste_10highscore = []
with open(self.chemin_fichier, mode='r', encoding='utf-8') as fichier_csv:
reader = csv.DictReader(fichier_csv)
for ligne in reader:
nom = ligne["Nom"]
scoreh = int(ligne["Highscore"]) # Convertir en entier
highscore = ScoreClass(nom, scoreh)
liste_10highscore.append(highscore)
# Trier les highscores par score décroissant
liste_10highscore.sort(key=lambda x: x.scoreh, reverse=True)
return liste_10highscore[:10] # Sélectionner les 10 meilleurs scores
# Classe pour écrire les scores dans un fichier CSV
class ScoreWriter:
def __init__(self, chemin_fichier):
self.chemin_fichier = chemin_fichier
def ecrire_high_scores(self, nom, scoreh):
with open(self.chemin_fichier, mode='a', newline='', encoding='utf-8') as fichier_csv:
writer = csv.writer(fichier_csv)
writer.writerow([nom, scoreh])
def verifierfont(font_path):
# Vérifier si la police Digital-7 est présente dans le dossier fonts système
if os.name == "nt": # Pour Windows
font_digital_7_path1 = "C:/Windows/Fonts/digital-7.ttf"
# Obtenir le nom d'utilisateur actuel
username = os.getlogin()
# Construire le chemin complet avec le nom d'utilisateur
font_path2 = fr'C:/Users/{username}/AppData/Local/Microsoft/Windows/Fonts'
font_digital_7_path2=font_path2+'/digital-7.ttf'
if os.path.exists(font_digital_7_path1) or os.path.exists(font_digital_7_path2):
return "digital-7"
else:
# Si la police Digital-7 n'est pas présente, installer la police demandée
try:
shutil.copy(font_path, font_path2)
print("La police a été installée avec succès dans", font_path2)
shutil.copy(font_path, "C:/Windows/Fonts")
print("La police a été installée avec succès dans", "C:/Windows/Fonts")
except Exception as e:
print("Erreur lors de la copie de la police:", e)
elif os.name == "posix": # Pour Linux
fonts_folder = "/usr/share/fonts/truetype"
font_digital_7_path = os.path.join(fonts_folder, "digital-7.ttf")
if os.path.exists(font_digital_7_path):
return "digital-7"
# Charger la police
if font_digital_7_path1 and os.path.exists(font_digital_7_path1) or font_digital_7_path2 and os.path.exists(font_digital_7_path2):
return "digital-7"
else:
return "comicsansms"
# Initialisation de Pygame
pygame.init()
# Obtenir le chemin absolu du répertoire contenant le script Python
current_dir = os.path.dirname(__file__)
# Chemin d'accès aux images,csv,font & sons à partir du répertoire media
chronometre_image_path = os.path.join(current_dir, "media", "chronometre.png")
ball_image_path = os.path.join(current_dir, "media", "ball.png")
logo_image_path = os.path.join(current_dir, "media", "FASTCLICK.png")
background_image_path= os.path.join(current_dir, "media", "BGphoto.jpg")
cloud_image_path= os.path.join(current_dir, "media", "BGcloud.jpg")
#############
click_m5pnt_son_path = os.path.join(current_dir, "media", "click-5pnt.wav")
click10pnt_son_path = os.path.join(current_dir, "media", "click10pnt.wav")
click_m10pnt_son_path = os.path.join(current_dir, "media", "click-10pnt.wav")
wall_ball_son_path = os.path.join(current_dir, "media", "wall_ball.wav")
effet_btn_son_path = os.path.join(current_dir, "media", "effetBTN.wav")
level_music_son_path = os.path.join(current_dir, "media", "level_music.wav")
intro_son_path = os.path.join(current_dir, "media", "intro.wav")
#############
csv_path = os.path.join("media", "highscore.csv") # Chargement de fichier CSV
font_path = os.path.join("media", "digital-7.ttf") # Chargement de la police
font_used= str(verifierfont(font_path)) #"digital-7"
# Chargez son
crashm5_sound = pygame.mixer.Sound(click_m5pnt_son_path)
crash10_sound = pygame.mixer.Sound(click10pnt_son_path)
crashm10_sound = pygame.mixer.Sound(click_m10pnt_son_path)
crashwall_sound = pygame.mixer.Sound(wall_ball_son_path)
effet_btn_sound = pygame.mixer.Sound(effet_btn_son_path)
intro_sound = pygame.mixer.Sound(intro_son_path)
# Définition des constantes
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_SIZE = (SCREEN_WIDTH, SCREEN_HEIGHT)
RECTANGLE_SIZE = 20
BALL_SIZE = 40
FPS = 60
PARTIE = 20000 # Countdown duration en milliseconds (20 seconds)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
BRIGHT_RED=(248, 131, 121)
GREEN=(0, 255, 0)
BRIGHT_GREEN=(170, 255, 0)
start_time = None
# Chargez l'image de l'icône du chronomètre
chronometre_icon_image = pygame.image.load(chronometre_image_path)
screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))
# Chargement de l'image d'arrière-plan
cloud_image = pygame.image.load(cloud_image_path)
# Redimensionnement de l'image pour qu'elle corresponde à la taille de l'écran
BGcloud_image = pygame.transform.scale(cloud_image, SCREEN_SIZE)
# Définition de la classe Rectangle
class Rectangle:
def __init__(self, x, y, color):
self.rect = pygame.Rect(x, y, RECTANGLE_SIZE, RECTANGLE_SIZE)
self.color = color
# Définition de la classe Ball
class Ball:
def __init__(self, x, y):
self.ball = pygame.image.load(ball_image_path) # Charger l'image de la balle
self.ball = pygame.transform.scale(self.ball, (BALL_SIZE, BALL_SIZE)) # Redimensionner l'image
self.rect = self.ball.get_rect() # Récupérer le rectangle englobant de l'image
self.rect.x = x
self.rect.y = y
self.speed_x = 2
self.speed_y = 2
# Fonction principale pour jouer
def main():
global score, highscore # Utilisez les variables score et highscore globalement
# Chargement de l'image d'arrière-plan
background_image = pygame.image.load(background_image_path)
# Redimensionnement de l'image pour qu'elle corresponde à la taille de l'écran
background_image = pygame.transform.scale(background_image, SCREEN_SIZE)
# Déclaration de la variable score
score = 0
try:
# Utilisation de la classe ScoreReader
lecteur_highscores = ScoreReader(csv_path)
highscores = lecteur_highscores.lirehighscores()
# Initialisation de highscore
highscore = 0
# Trouver le plus grand highscore
for scoreL in highscores:
# print(f"Nom: {scoreL.nom}, highscore= {scoreL.scoreh}")
if int(scoreL.scoreh) > highscore:
highscore = int(scoreL.scoreh)
except FileNotFoundError:
# Gérer l'erreur lorsque le fichier n'est pas trouvé
print("Le fichier highscore.csv n'a pas été trouvé.")
highscore = 0
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
clock = pygame.time.Clock()
game_over = False
# Start the countdown on game start
start_time = pygame.time.get_ticks()
# print("Start Time:", start_time) # Print start time for debugging
# Génération des objets
def generate_objects():
blue_rectangle = Rectangle(random.randint(0, SCREEN_WIDTH - RECTANGLE_SIZE),
random.randint(0, SCREEN_HEIGHT - RECTANGLE_SIZE), BLUE)
red_rectangle = Rectangle(random.randint(0, SCREEN_WIDTH - RECTANGLE_SIZE),
random.randint(0, SCREEN_HEIGHT - RECTANGLE_SIZE), RED)
ball = Ball(random.randint(0, SCREEN_WIDTH - BALL_SIZE),
random.randint(0, SCREEN_HEIGHT - BALL_SIZE))
return blue_rectangle, red_rectangle, ball
blue_rectangle, red_rectangle, ball = generate_objects()
############
pygame.mixer.music.load(level_music_son_path)
pygame.mixer.music.play(-1)
############
while not game_over:
# screen.fill(WHITE)
# Dessiner l'image d'arrière-plan pendant le jeu
screen.blit(background_image, (0, 0))
# Déplacement de la balle
ball.rect.x += ball.speed_x
ball.rect.y += ball.speed_y
# Rebondissement de la balle
if ball.rect.left <= 0 or ball.rect.right >= SCREEN_WIDTH:
ball.speed_x *= -1
pygame.mixer.Sound.play(crashwall_sound)
if ball.rect.top <= 0 or ball.rect.bottom >= SCREEN_HEIGHT:
ball.speed_y *= -1
pygame.mixer.Sound.play(crashwall_sound)
# Affichage des objets
pygame.draw.rect(screen, blue_rectangle.color, blue_rectangle.rect)
pygame.draw.rect(screen, red_rectangle.color, red_rectangle.rect)
screen.blit(ball.ball, ball.rect) # Affichage de la balle
# Calculate elapsed time
elapsed_time = pygame.time.get_ticks() - start_time
#print("Elapsed Time:", elapsed_time) # Print elapsed time for debugging
# Affichage du score
font = pygame.font.SysFont(font_used, 36)
score_text = font.render("Score: " + str(score), True, BLACK)
screen.blit(score_text, (10, 10))
# Affichage du highscore
highscore_text = font.render(f"Highscore: {str(highscore)}", True, BLACK)
screen.blit(highscore_text, ((SCREEN_WIDTH - highscore_text.get_width()) // 2, 10))
# Affichez l'image du chronomètre à la place du texte
screen.blit(chronometre_icon_image, (SCREEN_WIDTH - chronometre_icon_image.get_width() - 10, 10))
time_text = font.render(str((PARTIE-elapsed_time) // 1000), True, BLACK)
screen.blit(time_text, (SCREEN_WIDTH - time_text.get_width() - 34, 10))
# Rafraîchissement de l'écran
pygame.display.flip()
clock.tick(FPS)
# Gestion des événements
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_over = True
############
pygame.mixer.music.pause()
#############
quitgame()
elif event.type == pygame.MOUSEBUTTONDOWN:
if handle_rectangle_click(blue_rectangle, event.button):
blue_rectangle = Rectangle(random.randint(0, SCREEN_WIDTH - RECTANGLE_SIZE),
random.randint(0, SCREEN_HEIGHT - RECTANGLE_SIZE), BLUE)
elif handle_rectangle_click(red_rectangle, event.button):
red_rectangle = Rectangle(random.randint(0, SCREEN_WIDTH - RECTANGLE_SIZE),
random.randint(0, SCREEN_HEIGHT - RECTANGLE_SIZE), RED)
else:
if ball.rect.collidepoint(pygame.mouse.get_pos()):
score -= 10
####################################
pygame.mixer.Sound.play(crashm10_sound)
####################################
# Vérification du temps écoulé
if elapsed_time >= PARTIE:
game_over = True
show_end_screen(screen, score,highscore)
# Fonction pour afficher l'écran de fin de partie
def show_end_screen(screen, score, highscore):
#screen.fill(WHITE)
screen.blit(BGcloud_image, (0, 0))
############
pygame.mixer.music.pause()
#############
font = pygame.font.SysFont(font_used, 36)
end_text = font.render("Fin de partie", True, BLACK)
screen.blit(end_text, ((SCREEN_WIDTH - end_text.get_width()) // 2, 80))
score_text = font.render("Score: " + str(score), True, BLACK)
screen.blit(score_text, ((SCREEN_WIDTH - score_text.get_width()) // 2, 115))
if score >= highscore: # Vérifier si le score du joueur est supérieur ou égal au highscore actuel
# Texte d'invitation à saisir le nom
enter_name_text = font.render("Felicitations ! Entrez votre Nom", True, BLACK)
screen.blit(enter_name_text, ((SCREEN_WIDTH - enter_name_text.get_width()) // 2, 30))
pygame.display.flip()
# Zone de saisie du nom avec bouton de validation
input_box = pygame.Rect(250, 150, 230, 52)
button = pygame.Rect(410, 150, 130, 52)
color_inactive = pygame.Color(BRIGHT_GREEN)
color_active = pygame.Color(BLACK)
color = color_inactive
active = False
name = ''
done = False
# Variables pour gérer le clignotement du curseur
cursor_visible = True
cursor_switch_time = pygame.time.get_ticks()
# Focus automatique dans la zone de texte
active = True
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
if event.type == pygame.MOUSEBUTTONDOWN:
if input_box.collidepoint(event.pos):
active = not active
else:
active = False
# Changement de couleur de la zone de saisie selon qu'elle est active ou inactive
color = color_active if active else color_inactive
if button.collidepoint(event.pos):
done = True
if event.type == pygame.KEYDOWN:
if active:
if event.key == pygame.K_RETURN:
done = True
elif event.key == pygame.K_BACKSPACE:
name = name[:-1]
else:
name += event.unicode
# Gestion du clignotement du curseur
current_time = pygame.time.get_ticks()
if current_time - cursor_switch_time > 500: # Changer la visibilité du curseur toutes les 500 ms
cursor_visible = not cursor_visible
cursor_switch_time = current_time
#screen.fill(WHITE)
screen.blit(BGcloud_image, (0, 0))
# Affichage du texte d'invitation à saisir le nom
screen.blit(enter_name_text, ((SCREEN_WIDTH - enter_name_text.get_width()) // 2, 75))
# Affichage de la zone de texte
pygame.draw.rect(screen, color, input_box, 2)
pygame.draw.rect(screen, color_inactive, button)
# Affichage du texte saisi avec le curseur clignotant
txt_surface = font.render(name + ("|" if cursor_visible else ""), True, color)
screen.blit(txt_surface, (input_box.x + 5, input_box.y + 5))
# Affichage du bouton de validation
validation_text = font.render("Valider", True, BLACK)
screen.blit(validation_text, (415, 155))
pygame.display.flip()
# Écriture des scores dans un nouveau fichier CSV
writer = ScoreWriter(csv_path)
writer.ecrire_high_scores(name, score)
# Redirection vers l'écran Highscore ou affichage du nom et du score
highscore_screen()
else:
back_to_main_text = font.render("Reessayez plus tard \_(-_-)_/ !!", True, BLACK)
screen.blit(back_to_main_text, ((SCREEN_WIDTH - back_to_main_text.get_width()) // 2, 50))
pygame.display.flip()
pygame.time.delay(3000)
# Attendre que l'utilisateur appuie sur une touche pour revenir à l'écran principal
game_intro()
# Fonction pour afficher l'écran Highscore
def highscore_screen():
#screen.fill(WHITE)
screen.blit(BGcloud_image, (0, 0))
# Créer une instance de ScoreReader pour lire les highscores depuis le fichier
reader = ScoreReader(csv_path)
highscores = reader.lirehighscores()
pygame.draw.rect(screen,(255, 165, 0),(0,40,SCREEN_WIDTH,75))
pygame.draw.rect(screen,(255, 192, 0),(0,50,SCREEN_WIDTH,55))
# Affichage du titre
font_title = pygame.font.SysFont(font_used, 48)
title_text = font_title.render("Liste des Highscores", True, BLACK)
screen.blit(title_text, ((SCREEN_WIDTH - title_text.get_width()) // 2, 50))
# Affichage des 10 premiers highscores
font_scores = pygame.font.SysFont(font_used, 44)
y_position = 150
for i, score in enumerate(highscores):
score_text = font_scores.render(f"{i+1}.", True, BLACK)
screen.blit(score_text, (175, y_position)) # Aligner le texte à gauche (x = 275)
y_position += 30
y_position = 150
for i, score in enumerate(highscores):
score_text = font_scores.render(f"{score.nom}", True, BLACK)
screen.blit(score_text, (275, y_position)) # Aligner le texte à gauche (x = 275)
y_position += 30
y_position = 150
for i, score in enumerate(highscores):
score_text = font_scores.render(f"{score.scoreh}", True, BLACK)
screen.blit(score_text, (555, y_position)) # Aligner le texte à gauche (x = 275)
y_position += 30
pygame.draw.rect(screen,(255, 165, 0),(0,500,SCREEN_WIDTH,85))
pygame.draw.rect(screen,(255, 192, 0),(0,510,SCREEN_WIDTH,65))
# Initialisation des variables pour la gestion du clignotement du texte
last_toggle_time = pygame.time.get_ticks()
toggle_interval = 500 # intervalle de clignotement en millisecondes
# Fonction pour alterner entre deux couleurs pour le texte
def toggle_text_color(color1, color2):
return color1 if pygame.time.get_ticks() % (2 * toggle_interval) < toggle_interval else color2
pygame.display.flip() # Mettre à jour l'écran après avoir dessiné les boutons
# Attente de l'appui sur le bouton de retour
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_intro()
elif event.type == pygame.MOUSEBUTTONDOWN:
if button_rect.collidepoint(event.pos):
game_intro()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
game_intro()
# Affichage du bouton de retour à l'écran d'accueil
button_rect = pygame.Rect((SCREEN_WIDTH - 200) // 2, 518, 200, 50)
pygame.draw.rect(screen, RED, button_rect)
font_button = pygame.font.SysFont(font_used, 32)
button_text = font_button.render("<<< Retour", True, toggle_text_color(BRIGHT_RED, WHITE))
text_rect = button_text.get_rect(center=button_rect.center)
screen.blit(button_text, text_rect)
pygame.display.flip()
# Fonction pour gérer les clics sur les rectangles
def handle_rectangle_click(rectangle, button):
global score # Declare score as global within the function
if button == 1: # Clic gauche
if rectangle.rect.collidepoint(pygame.mouse.get_pos()): # Vérifie si le clic est sur le rectangle actuel
if rectangle.color == RED:
score -= 5
####################################
pygame.mixer.Sound.play(crashm5_sound)
####################################
elif rectangle.color == BLUE:
score += 10
####################################
pygame.mixer.Sound.play(crash10_sound)
####################################
return True
return False
elif button == 3: # Clic droit
if rectangle.rect.collidepoint(pygame.mouse.get_pos()): # Vérifie si le clic est sur le rectangle actuel
if rectangle.color == BLUE:
score -= 5 # Réduit le score de 5
####################################
pygame.mixer.Sound.play(crashm5_sound)
####################################
elif rectangle.color == RED:
score += 10
####################################
pygame.mixer.Sound.play(crash10_sound)
####################################
return True
return False
def button(msg,x,y,w,h,ic,ac,action=None):
mouse = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
if x+w > mouse[0] > x and y+h > mouse[1] > y:
pygame.draw.rect(screen, ac,(x,y,w,h))
if click[0] == 1 and action != None:
action()
# ####################################
# effet_btn_sound.play()
# ####################################
else:
pygame.draw.rect(screen, ic,(x,y,w,h))
smallText = pygame.font.SysFont(font_used,25) #"comicsansms"
textSurf, textRect = text_objectsBTN(msg, smallText)
textRect.center = ( (x+(w/2)), (y+(h/2)) )
screen.blit(textSurf, textRect)
def game_intro():
intro = True
############
intro_sound.play() # Jouer le son une seule fois
############
while intro:
for event in pygame.event.get():
#print(event)
if event.type == pygame.QUIT:
pygame.quit()
quit()
# screen.fill(WHITE)
screen.blit(BGcloud_image, (0, 0))
# Charger l'image du logo et la redimensionner
logo = pygame.image.load(logo_image_path)
# Redimensionner l'image
logo = pygame.transform.scale(logo, (300, 300))
# Dessiner l'image redimensionnée sur l'écran
screen.blit(logo, ((SCREEN_WIDTH - 300) // 2, ((SCREEN_HEIGHT - 300) // 2)-35))
largeText = pygame.font.SysFont(font_used,115) #avant "comicsansms"
TextSurf, TextRect = text_objects("FastClick", largeText)
TextRect.center = ((SCREEN_WIDTH/2),(SCREEN_HEIGHT/2)-250)
screen.blit(TextSurf, TextRect)
pygame.draw.rect(screen,(255, 165, 0),(0,440,SCREEN_WIDTH,115))
pygame.draw.rect(screen,(255, 192, 0),(0,460,SCREEN_WIDTH,75))
button("",116,470,195,55,BRIGHT_RED,RED,main)
button("Nouvelle Partie !",118,468,190,50,RED,BRIGHT_RED,main)
button("",338,470,135,55,BRIGHT_RED,RED,highscore_screen)
button("Highscores",340,468,130,50,RED,BRIGHT_RED,highscore_screen)
button("",504,470,105,55,BRIGHT_RED,RED,quitgame)
button("Quitter",506,468,100,50,RED,BRIGHT_RED,quitgame)
pygame.display.update()
def text_objects(text, font):
textSurface = font.render(text, True, WHITE)
return textSurface, textSurface.get_rect()
def text_objectsBTN(text, font):
textSurface = font.render(text, True, BLACK)
return textSurface, textSurface.get_rect()
def quitgame():
pygame.quit()
quit()
game_intro()