You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the snake printing to show a keypress, the second time you run snake, you will see multiple prints for each key press
if e.type == pg.KEYDOWN:
if game_running == 0:
game_runnig = 1
if e.key == pg.K_SPACE:
game_running = 0
snake = [(7, 3), (7, 4)]
direction = 0
apple = place_apple()
for i in range(4):
if e.key == dirs[i] and direction != (i + 2) % 4:
direction = i
print direction
The text was updated successfully, but these errors were encountered:
When you run the code a second or third time key press events will trigger a second or third time.
To see the bug go to the example https://petlja.github.io/pygame4skulpt/
Run the snake printing to show a keypress, the second time you run snake, you will see multiple prints for each key press
if e.type == pg.KEYDOWN:
if game_running == 0:
game_runnig = 1
if e.key == pg.K_SPACE:
game_running = 0
snake = [(7, 3), (7, 4)]
direction = 0
apple = place_apple()
for i in range(4):
if e.key == dirs[i] and direction != (i + 2) % 4:
direction = i
print direction
The text was updated successfully, but these errors were encountered: