Key i added for current level information.
This commit is contained in:
@@ -66,9 +66,9 @@ class WickedQuest:
|
||||
pygame.event.pump()
|
||||
|
||||
# Update running and ducking states
|
||||
if keys[pygame.K_s] and not player.isDucking:
|
||||
if (keys[pygame.K_s] or keys[pygame.K_DOWN]) and not player.isDucking:
|
||||
player.duck()
|
||||
elif not keys[pygame.K_s] and player.isDucking:
|
||||
elif (not keys[pygame.K_s] and not keys[pygame.K_DOWN]) and player.isDucking:
|
||||
player.stand()
|
||||
|
||||
player.isRunning = keys[pygame.K_SPACE]
|
||||
@@ -80,11 +80,11 @@ class WickedQuest:
|
||||
movementDistance = 0
|
||||
|
||||
# Horizontal movement
|
||||
if keys[pygame.K_a]: # Left
|
||||
if keys[pygame.K_a] or keys[pygame.K_LEFT]: # Left
|
||||
movementDistance = currentSpeed
|
||||
player.xPos -= currentSpeed
|
||||
player.facingRight = False
|
||||
elif keys[pygame.K_d]: # Right
|
||||
elif keys[pygame.K_d] or keys[pygame.K_RIGHT]: # Right
|
||||
movementDistance = currentSpeed
|
||||
player.xPos += currentSpeed
|
||||
player.facingRight = True
|
||||
@@ -102,11 +102,13 @@ class WickedQuest:
|
||||
speak(f"{player.get_coins()} gbone dust")
|
||||
if keys[pygame.K_h]:
|
||||
speak(f"{player.get_health()} health of {player.get_max_health()}")
|
||||
if keys[pygame.K_i]:
|
||||
speak(f"Level {self.currentLevel.levelId}, {self.currentLevel.levelName}. {player.get_health()} health of {player.get_max_health()}. {player.get_lives()} lives remaining.")
|
||||
if keys[pygame.K_l]:
|
||||
speak(f"{player.get_lives()} lives")
|
||||
if keys[pygame.K_j]: # Check jack o'lanterns
|
||||
speak(f"{player.get_jack_o_lanterns()} jack o'lanterns")
|
||||
if keys[pygame.K_f]:
|
||||
if keys[pygame.K_f] or keys[pygame.K_LALT] or keys[pygame.K_RALT]:
|
||||
currentTime = pygame.time.get_ticks()
|
||||
if currentTime - self.lastThrowTime >= self.throwDelay:
|
||||
self.currentLevel.throw_projectile()
|
||||
@@ -119,7 +121,7 @@ class WickedQuest:
|
||||
play_sound(self.sounds[player.currentWeapon.attackSound])
|
||||
|
||||
# Handle jumping
|
||||
if keys[pygame.K_w] and not player.isJumping:
|
||||
if (keys[pygame.K_w] or keys[pygame.K_UP]) and not player.isJumping:
|
||||
player.isJumping = True
|
||||
player.jumpStartTime = currentTime
|
||||
play_sound(self.sounds['jump'])
|
||||
|
Reference in New Issue
Block a user