Possible infinite loop

Forum organization and occasional community-building.
Forum rules
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
Gonggrijp
Newbie
Posts: 4
Joined: Sun Aug 09, 2020 10:08 am
Completed: None (yet)
Projects: Bond of Heroes
Location: Belgium
Contact:

Possible infinite loop

#1 Post by Gonggrijp »

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:

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
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?

Post Reply

Who is online

Users browsing this forum: No registered users