Add run lock toggle, so you can lock the running state and then use space or shift to walk. Keybinding is tab or capslock. Update all external references to coin to be bone dust instead. Change the sound names to match. Now the only coin references are in the code itself.
This commit is contained in:
11
wicked_quest.py
Normal file → Executable file
11
wicked_quest.py
Normal file → Executable file
@@ -18,6 +18,7 @@ class WickedQuest:
|
||||
self.throwDelay = 250
|
||||
self.player = None
|
||||
self.currentGame = None
|
||||
self.runLock = False # Toggle behavior of the run keys
|
||||
|
||||
def load_level(self, levelNumber):
|
||||
"""Load a level from its JSON file."""
|
||||
@@ -71,8 +72,11 @@ class WickedQuest:
|
||||
elif (not keys[pygame.K_s] and not keys[pygame.K_DOWN]) and player.isDucking:
|
||||
player.stand()
|
||||
|
||||
player.isRunning = keys[pygame.K_SPACE] or keys[pygame.K_LSHIFT] or keys[pygame.K_RSHIFT]
|
||||
|
||||
if self.runLock:
|
||||
player.isRunning = not (keys[pygame.K_SPACE] or keys[pygame.K_LSHIFT] or keys[pygame.K_RSHIFT])
|
||||
else:
|
||||
player.isRunning = keys[pygame.K_SPACE] or keys[pygame.K_LSHIFT] or keys[pygame.K_RSHIFT]
|
||||
|
||||
# Get current speed (handles both running and jumping)
|
||||
currentSpeed = player.get_current_speed()
|
||||
|
||||
@@ -208,6 +212,9 @@ class WickedQuest:
|
||||
except:
|
||||
pass
|
||||
return
|
||||
elif event.key in [pygame.K_CAPSLOCK, pygame.K_TAB]:
|
||||
self.runLock = not self.runLock
|
||||
speak("Run lock " + ("enabled." if self.runLock else "disabled."))
|
||||
# Volume controls (require Alt)
|
||||
elif altPressed:
|
||||
if event.key == pygame.K_PAGEUP:
|
||||
|
Reference in New Issue
Block a user