I'm making a Mineclone, but am stuck in the sprinting bit.
I want code that will put the player in 'sprinting' mode when you press Ctrl, as long as you have w pressed, and exit sprinting when w is released. Releasing Ctrl while sprinting should do nothing. I tried this code among many others, but when I test it, it freezes.
def update():
global block_pick
if held_keys['control'] and held_keys['w']:
while held_keys['w']:
player.speed = 10
So the code would check every frame.