Fixed errors in documentation for level creation. Fixed some save loading bugs.
This commit is contained in:
@@ -291,13 +291,13 @@ The `maximum_skulls` setting controls how many skulls can be falling simultaneou
|
||||
"x": 55,
|
||||
"y": 0,
|
||||
"type": "catapult",
|
||||
"fire_interval": 4000,
|
||||
"fireInterval": 4000,
|
||||
"range": 25
|
||||
}
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `fire_interval`: Milliseconds between shots
|
||||
- `fireInterval`: Milliseconds between shots (note: camelCase, not snake_case)
|
||||
- `range`: How far the catapult can shoot
|
||||
|
||||
#### Spider Web
|
||||
@@ -660,8 +660,7 @@ Here's how to transform a Halloween level into a Christmas level using sound ove
|
||||
"type": "grave",
|
||||
"item": "shin_bone",
|
||||
"sound_overrides": {
|
||||
"base": "snow_pile",
|
||||
"item": "candy_cane"
|
||||
"item": "candy_cane"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -682,7 +681,7 @@ Here's how to transform a Halloween level into a Christmas level using sound ove
|
||||
- Weapons sound winter-themed when attacking
|
||||
- "Catapult" becomes "Snowball Launcher" with appropriate launch sounds
|
||||
- "Skull Storm" becomes "Snowball Storm"
|
||||
- "Graves" become "Snow Piles" containing "Candy Canes" instead of "Shin Bones"
|
||||
- "Graves" containing "Candy Canes" instead of "Shin Bones" (sound override only - base grave sound unchanged)
|
||||
- "Grasping Hands" becomes "Avalanche" with snow-themed death messages
|
||||
- All mechanics remain identical - only audio and messaging changes
|
||||
|
||||
@@ -767,7 +766,7 @@ Here's a comprehensive example showing multiple advanced features:
|
||||
"x": 100,
|
||||
"y": 0,
|
||||
"type": "catapult",
|
||||
"fire_interval": 3000,
|
||||
"fireInterval": 3000,
|
||||
"range": 30
|
||||
},
|
||||
{
|
||||
|
||||
@@ -231,8 +231,6 @@ class Player:
|
||||
self._lives -= 1
|
||||
# Mark that player died this frame to prevent revival
|
||||
self.diedThisFrame = True
|
||||
# Record death time for delay before respawn/game over
|
||||
self.deathTimestamp = pygame.time.get_ticks()
|
||||
# Stop all current sounds before playing death sound
|
||||
pygame.mixer.stop()
|
||||
try:
|
||||
|
||||
@@ -274,8 +274,8 @@ class WickedQuest:
|
||||
play_sound(self.get_sounds()['jump'])
|
||||
|
||||
# Handle instant landing with broom (press down while jumping)
|
||||
if (player.isJumping and (keys[pygame.K_s] or keys[pygame.K_DOWN]) and
|
||||
player.currentWeapon and player.currentWeapon.name == "witch_broom"):
|
||||
if (player.isJumping and (keys[pygame.K_s] or keys[pygame.K_DOWN]) and
|
||||
player.currentWeapon and getattr(player.currentWeapon, 'originalName', player.currentWeapon.name) == "witch_broom"):
|
||||
player.isJumping = False
|
||||
play_sound(self.get_sounds()[player.footstepSound]) # Landing sound
|
||||
# Reset step distance tracking after landing
|
||||
@@ -433,15 +433,6 @@ class WickedQuest:
|
||||
|
||||
# Check for death first
|
||||
if self.currentLevel.player.get_health() <= 0:
|
||||
# Check if we need to wait for death delay (2.5 seconds)
|
||||
if hasattr(self.currentLevel.player, 'deathTimestamp'):
|
||||
deathDelay = 2500 # 2.5 seconds
|
||||
if currentTime - self.currentLevel.player.deathTimestamp < deathDelay:
|
||||
# Still waiting for death delay to complete
|
||||
clock.tick(60)
|
||||
continue
|
||||
# Death delay completed, remove timestamp
|
||||
del self.currentLevel.player.deathTimestamp
|
||||
|
||||
if self.currentLevel.player.get_lives() <= 0:
|
||||
# Game over - use gameStartTime for total time
|
||||
@@ -521,6 +512,10 @@ class WickedQuest:
|
||||
if self.load_level(current_level):
|
||||
# Restore player state
|
||||
self.saveManager.restore_player_state(self.player, save_data)
|
||||
# Re-apply weapon overrides after restoring player state to ensure
|
||||
# sound/name overrides work with restored weapon properties
|
||||
if hasattr(self.currentLevel, 'weaponOverrides') and self.currentLevel.weaponOverrides:
|
||||
self.currentLevel._apply_weapon_overrides(self.currentLevel.weaponOverrides)
|
||||
self.game_loop(current_level)
|
||||
else:
|
||||
messagebox("Failed to load saved level.")
|
||||
@@ -657,15 +652,6 @@ class WickedQuest:
|
||||
|
||||
# Check for death first (following main game loop pattern)
|
||||
if self.currentLevel.player.get_health() <= 0:
|
||||
# Check if we need to wait for death delay (2.5 seconds)
|
||||
if hasattr(self.currentLevel.player, 'deathTimestamp'):
|
||||
deathDelay = 2500 # 2.5 seconds
|
||||
if currentTime - self.currentLevel.player.deathTimestamp < deathDelay:
|
||||
# Still waiting for death delay to complete
|
||||
clock.tick(60)
|
||||
continue
|
||||
# Death delay completed, remove timestamp
|
||||
del self.currentLevel.player.deathTimestamp
|
||||
|
||||
if self.currentLevel.player.get_lives() <= 0:
|
||||
# Game over - stop all sounds
|
||||
|
||||
Reference in New Issue
Block a user