Possible infinite loop
Posted: Sun Aug 16, 2020 3:22 pm
I’m trying to create a game with basically 2 phases: One phase will be a visual novel, the other will be more RPG-like. I want to move the sprite around with keyboard inputs during the second phase, but I keep running into errors.
My code:
The problem is that Ren’Py tells me that this is a possible infinite loop. I understand why it would think this is an infinite loop, but I have no idea how I could possibly solve this. Any ideas?
My code:
Code: Select all
$ move_allowed = 1
while move_allowed == 1:
if pygame.key.get_pressed()[pygame.K_z]:
$ posi -= 0.01
elif pygame.key.get_pressed()[pygame.K_s]:
$ posi ++ 0.01
elif pygame.key.get_pressed()[pygame.K_q]:
$ posi -= 1.0
elif pygame.key.get_pressed()[pygame.K_d]:
$ posi ++ 1.0
elif pygame.key.get_pressed()[pygame.K_k]:
$ move_allowed = 0