Salut les python jeux vidéo.

Il s'avère que j'ai sortie un jeu qui s'appelle SnakeByte pour Linux et Windows: une sorte de pacman ou vous incarnez un serpent qui est enfermer dans un labyrinthe ou il y a des fantômes et des pommes a manger. Si vous percutez un fantome ou un mur vous perdez une vie sur les 10 dont vous disposez pour manger toutes les pommes ce qui permet d'ouvrir la porte du labyrinthe et si vous parvenez a sortir vous avez gagner...

Le serpent avance normalement constamment en pouvant slider a droite et gauche ainsi que tourner dans les deux directions.
Et vous pouvez stopper l'avancement du serpent en appuyant sur 'z' (AZERTY) ou 'w' (QWERTY) et le refaire avancer en appuyant sur le même bouton.

Le jeu une fois que l'on sait manier correctement le serpent (Ne plus se tromper de direction en fonction du sens du serpent) et bien le jeux devient très intéressant a jouer je trouve personnellement.

Seulement le jeu comporte un bug qui vous pourrit carrément la vie c'est que parfois quand vous bloquer l'anvancement du serpent (touche 'z') il refuse dese remettre en marche des que l'on appuie de nouveau sur 'z' et cela a souvant la consequence de perdre une vie et se produit trop souvent pour le laisser passer.

J'ai bien sur tenter de résoudre le problème mais il ne semble pas y avoir de faute de programmation qui provoque cela.

Alors dîtes moi le contraire et ou j'ai fait une faute et je serai comblé.

Bref si la chasse au bug vous dit je vous fait des liens.

ET vous montre le la mainloop de jeux ici:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
while run :
 
      screen.fill(playground.background_color)
 
      if game_control.animate_start_game :
	playground.set_snake_color_start_animation(i)
        playground.draw_playground()
        pygame.display.update()
        i += 1
	if  ( i == 16) :
	  game_control.animate_start_game=False
	else :
	  sleep(0.25)
	continue
 
 
      if game_control.animation_losing :
	if playground.losing_bink_time :
	  playground.losing_blink_snake()
	else :
	  snake.snake_speed=snake.snake_speed*1.1
 
	  ret=playground.losing_change_snake_color_gradient()
	if ( not ret) :
	  playground.draw_playground()
	  playground.losing_bink_time=False
	  game_control.game_over=True
	  game_control.animation_losing=False
	  run=False
	  break
 
 
 
 
      if game_control.animate_phantom and not game_control.animation_exit_open_running :
	playground.phamtoms_forward()
	level.compute_phantom_collide_rect_list()
 
 
      if not game_control.snake_stop and not game_control.animation_blocking and not game_control.animation_slide and not game_control.animation_losing and not game_control.animation_exit_open_running  :
	snake.forward()
	pass
 
 
 
      playground.draw_playground()
 
 
 
      if not game_control.exit_closed  :
	win_bool=playground.check_snake_go_exit()
	if win_bool :
	  win_end_game_anim_counter += 1
	  if win_end_game_anim_counter == 3 :
	    game_control.snake_player_win=True
	    game_control.animation_blocking=True
	    game_control.animation_losing=True
            game_sound.losing_sound_play()
	    game_control.animate_phantom =  False
 
      if not game_control.animation_losing :
	# Comment following line to not lose by hit the phantoms.
	game_control.animation_losing=playground.check_phantom_colliding()
	if game_control.animation_losing :
	  game_control.snake_lifes -= 1
	  game_control.animate_phantom =  False
 
      if not game_control.animation_losing  :
	# Comment following line to not lose by hit the walls.
	game_control.animation_losing=playground.check_barriers_colliding()
	pass
	if game_control.animation_losing :
	  game_control.snake_lifes -= 1
	  game_control.animate_phantom =  False
	pass
 
      if not game_control.all_apples_eat  :
	game_control.all_apples_eat=playground.check_eat_apple_colliding()
 
      if game_control.all_apples_eat and not game_control.animation_exit_open_running and game_control.exit_closed  :
	# Open exit animation starting.
	playground.start_animation_exit_open()
 
 
      #Event getting loop with conditionnal structure to handle
      for event in pygame.event.get() :
 
	if event.type == QUIT :
	  exit()
 
	if event.type == USEREVENT and event.code == "opening_animation" :
	  if game_control.exit_closed :
	    playground.set_animation_exit_open_next()
 
	    next_step_anim_event=pygame.event.Event(USEREVENT, {'code' : "opening_animation"} )
	    pygame.event.post(next_step_anim_event)
 
	    continue
 
 
	if event.type == KEYDOWN :
	  if game_control.animation_losing :
	    continue
 
 
	  if event.key == K_RIGHT :
	    if not game_control.snake_stop :
	      if (snake.anim_turn_length <= snake.length) :
		game_control.set_animation_blocking_on()
		if snake.anim_turn_length == 1 :
		  game_control.set_animation_turning_right_on()
		  game_sound.turn_right_sound_play()
		if ( not game_control.animation_turning_left and not game_control.animation_slide ) :
		  snake.turn_right(snake.anim_turn_length)
 
		  playground.draw_playground()
		  next_step_anim_event=pygame.event.Event(KEYDOWN, {'key' : K_RIGHT} )
		  pygame.event.post(next_step_anim_event)
		  continue
 
	      else :
		snake.anim_turn_length=1
		game_control.set_animation_blocking_off()
		continue
 
 
 
	  elif event.key == K_LEFT :
	    if not game_control.snake_stop :
	      if (snake.anim_turn_length <= snake.length) :
		game_control.set_animation_blocking_on()
		if snake.anim_turn_length == 1 :
		  game_control.set_animation_turning_left_on()
		  game_sound.turn_left_sound_play()
		if ( not game_control.animation_turning_right and not game_control.animation_slide ) :
		  snake.turn_left(snake.anim_turn_length)
 
		  playground.draw_playground()
		  next_step_anim_event=pygame.event.Event(KEYDOWN, {'key' : K_LEFT} )
		  pygame.event.post(next_step_anim_event)
		  continue
	      else :
		snake.anim_turn_length=1
		game_control.set_animation_blocking_off()
		continue
 
 
	  elif event.key == K_q or event.key == K_a :
	    if not game_control.snake_stop :
	      game_control.set_animation_sliding_on()
 
	      snake.anim_slide_left()
	      game_sound.turn_slide_sound_play()
 
	      playground.draw_playground()
	      game_control.set_animation_sliding_off()
 
	      continue
 
	  elif event.key == K_d :
	    if not game_control.snake_stop :
	      game_control.set_animation_sliding_on()
 
	      snake.anim_slide_right() # Slide the snake to the right from one field in the actual orientation.
	      game_sound.turn_slide_sound_play()
 
	      playground.draw_playground()
	      game_control.set_animation_sliding_off()
 
	      continue
 
	  elif event.key == K_z or event.key == K_w :
	    if not game_control.snake_stop :
	      game_control.snake_stop=True
	      playground.draw_playground()
	      sleep(snake.snake_speed)
	      pygame.display.update()
	      continue
	    else :
	      game_control.snake_stop=False
	      playground.draw_playground()
	      sleep(snake.snake_speed)
	      pygame.display.update()
	      continue
 
	  elif event.key == K_ESCAPE :
	    run=False
	    self.start_game_animation()
 
 
      playground.draw_playground()
      sleep(snake.snake_speed)
 
      pygame.display.update()
 
    if game_control.snake_lifes == 0 or win_bool :
      self.game_over_display()
    else :
      self.lose_a_life_display()

Download SnakeByte Windows.

Download SnakeByte Linux.
Sources on github from SnakeByte.

Si vous avez l'âme d'un chasseur de bug et|ou si le cœur vous en dit je vous erai reconnaissant de bien vouloir essayer de m'aider.

Merci pour vos réponses et votre aide précieuse.