43
43
colorTrB = (255 , 0 , 0 )
44
44
dX = {'N' :0 ,'S' :0 ,'E' :1 ,'O' :- 1 }
45
45
dY = {'N' :- 1 ,'S' :1 ,'E' :0 ,'O' :0 }
46
+ colorFond = (255 ,255 ,255 )
46
47
47
48
# Fonction qui transforme un labyrinthe en une chaine de caractère pour le sauvegarder
48
49
@@ -282,7 +283,7 @@ def move(way,liste):
282
283
283
284
# On définit le taux de rafraichissement de l'affichage sur 60 Hz et on remplit le fond d'une couleur blanche
284
285
clock .tick (60 )
285
- window .fill (( 255 , 255 , 255 ) )
286
+ window .fill (colorFond )
286
287
287
288
# De base, on se trouve sur le menu avec deux choix : Jouer un nouveau niveau ou rejouer un ancien pour battre son score
288
289
@@ -367,8 +368,7 @@ def move(way,liste):
367
368
for y in range (len (liste )): # On actualise l'affichage du labyrinthe
368
369
for x in range (len (liste [y ])):
369
370
if liste [y ][x ] == '0' :
370
- rect = pygame .Rect (x * 10 , y * 10 , 10 , 10 )
371
- pygame .draw .rect (window , (0 ,0 ,0 ), rect )
371
+ continue
372
372
373
373
elif liste [y ][x ] == '1' or (liste [y ][x ] == '4' and tracer == False ):
374
374
rect = pygame .Rect (x * 10 , y * 10 , 10 , 10 )
@@ -389,20 +389,20 @@ def move(way,liste):
389
389
pygame .draw .rect (window , (128 ,0 ,128 ), rect )
390
390
391
391
elif liste [y ][x ] == '5' :
392
- rect = pygame .Rect (x * 10 , y * 10 + 8 , 10 , 2 )
393
- pygame .draw .rect (window , (0 , 0 , 0 ), rect )
392
+ rect = pygame .Rect (x * 10 , y * 10 , 10 , 8 )
393
+ pygame .draw .rect (window , (255 , 255 , 255 ), rect )
394
394
395
395
elif liste [y ][x ] == '6' :
396
- rect = pygame .Rect (x * 10 , y * 10 , 10 , 2 )
397
- pygame .draw .rect (window , (0 , 0 , 0 ), rect )
396
+ rect = pygame .Rect (x * 10 , y * 10 + 2 , 10 , 8 )
397
+ pygame .draw .rect (window , (255 , 255 , 255 ), rect )
398
398
399
399
elif liste [y ][x ] == '7' :
400
- rect = pygame .Rect (x * 10 + 8 , y * 10 , 2 , 10 )
401
- pygame .draw .rect (window , (0 , 0 , 0 ), rect )
400
+ rect = pygame .Rect (x * 10 , y * 10 , 8 , 10 )
401
+ pygame .draw .rect (window , (255 , 255 , 255 ), rect )
402
402
403
403
elif liste [y ][x ] == '8' :
404
- rect = pygame .Rect (x * 10 , y * 10 , 2 , 10 )
405
- pygame .draw .rect (window , (0 , 0 , 0 ), rect )
404
+ rect = pygame .Rect (x * 10 + 2 , y * 10 , 8 , 10 )
405
+ pygame .draw .rect (window , (255 , 255 , 255 ), rect )
406
406
407
407
elif liste [y ][x ] == '9' :
408
408
if difficult != 3 :
@@ -451,8 +451,13 @@ def move(way,liste):
451
451
delay += 1 / 60
452
452
if delay > 1.5 :
453
453
if regenonce == True :
454
- gen_new_maze ( int ((xWindow - 10 )/ 20 ), int ((yWindow - 10 )/ 20 ) )
455
- buff = liste
454
+ if difficult == 3 :
455
+ gen_new_maze (60 ,30 )
456
+ update_size_screen (10 ,10 )
457
+ buff = liste .copy ()
458
+ liste , playerloc = reduce_maze (buff )
459
+ else :
460
+ gen_new_maze ( int ((xWindow - 10 )/ 20 ), int ((yWindow - 10 )/ 20 ) )
456
461
t0 = time .monotonic ()
457
462
regenonce = False
458
463
regenonce = True
@@ -534,6 +539,7 @@ def move(way,liste):
534
539
if event .key == K_b : # Touche B -> Touche Retour
535
540
play , replay , settings , finish , tracer = [False ] * 5
536
541
update_size_screen (25 ,25 )
542
+ colorFond = (255 ,255 ,255 )
537
543
538
544
539
545
if event .type == pygame .MOUSEBUTTONDOWN and event .button == 1 : # On gère les actions avec la souris
@@ -555,6 +561,7 @@ def move(way,liste):
555
561
play = True
556
562
settings = False
557
563
nametxt = ''
564
+ colorFond = (0 ,0 ,0 )
558
565
559
566
if buttonSwitchR .collidepoint (mouse_pos ):
560
567
set_difficult (1 )
0 commit comments