Fixed errors in documentation for level creation. Fixed some save loading bugs.
This commit is contained in:
+4
-5
@@ -291,13 +291,13 @@ The `maximum_skulls` setting controls how many skulls can be falling simultaneou
|
|||||||
"x": 55,
|
"x": 55,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"type": "catapult",
|
"type": "catapult",
|
||||||
"fire_interval": 4000,
|
"fireInterval": 4000,
|
||||||
"range": 25
|
"range": 25
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Properties:**
|
**Properties:**
|
||||||
- `fire_interval`: Milliseconds between shots
|
- `fireInterval`: Milliseconds between shots (note: camelCase, not snake_case)
|
||||||
- `range`: How far the catapult can shoot
|
- `range`: How far the catapult can shoot
|
||||||
|
|
||||||
#### Spider Web
|
#### Spider Web
|
||||||
@@ -660,7 +660,6 @@ Here's how to transform a Halloween level into a Christmas level using sound ove
|
|||||||
"type": "grave",
|
"type": "grave",
|
||||||
"item": "shin_bone",
|
"item": "shin_bone",
|
||||||
"sound_overrides": {
|
"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
|
- Weapons sound winter-themed when attacking
|
||||||
- "Catapult" becomes "Snowball Launcher" with appropriate launch sounds
|
- "Catapult" becomes "Snowball Launcher" with appropriate launch sounds
|
||||||
- "Skull Storm" becomes "Snowball Storm"
|
- "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
|
- "Grasping Hands" becomes "Avalanche" with snow-themed death messages
|
||||||
- All mechanics remain identical - only audio and messaging changes
|
- All mechanics remain identical - only audio and messaging changes
|
||||||
|
|
||||||
@@ -767,7 +766,7 @@ Here's a comprehensive example showing multiple advanced features:
|
|||||||
"x": 100,
|
"x": 100,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"type": "catapult",
|
"type": "catapult",
|
||||||
"fire_interval": 3000,
|
"fireInterval": 3000,
|
||||||
"range": 30
|
"range": 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -231,8 +231,6 @@ class Player:
|
|||||||
self._lives -= 1
|
self._lives -= 1
|
||||||
# Mark that player died this frame to prevent revival
|
# Mark that player died this frame to prevent revival
|
||||||
self.diedThisFrame = True
|
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
|
# Stop all current sounds before playing death sound
|
||||||
pygame.mixer.stop()
|
pygame.mixer.stop()
|
||||||
try:
|
try:
|
||||||
|
|||||||
+5
-19
@@ -275,7 +275,7 @@ class WickedQuest:
|
|||||||
|
|
||||||
# Handle instant landing with broom (press down while jumping)
|
# Handle instant landing with broom (press down while jumping)
|
||||||
if (player.isJumping and (keys[pygame.K_s] or keys[pygame.K_DOWN]) and
|
if (player.isJumping and (keys[pygame.K_s] or keys[pygame.K_DOWN]) and
|
||||||
player.currentWeapon and player.currentWeapon.name == "witch_broom"):
|
player.currentWeapon and getattr(player.currentWeapon, 'originalName', player.currentWeapon.name) == "witch_broom"):
|
||||||
player.isJumping = False
|
player.isJumping = False
|
||||||
play_sound(self.get_sounds()[player.footstepSound]) # Landing sound
|
play_sound(self.get_sounds()[player.footstepSound]) # Landing sound
|
||||||
# Reset step distance tracking after landing
|
# Reset step distance tracking after landing
|
||||||
@@ -433,15 +433,6 @@ class WickedQuest:
|
|||||||
|
|
||||||
# Check for death first
|
# Check for death first
|
||||||
if self.currentLevel.player.get_health() <= 0:
|
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:
|
if self.currentLevel.player.get_lives() <= 0:
|
||||||
# Game over - use gameStartTime for total time
|
# Game over - use gameStartTime for total time
|
||||||
@@ -521,6 +512,10 @@ class WickedQuest:
|
|||||||
if self.load_level(current_level):
|
if self.load_level(current_level):
|
||||||
# Restore player state
|
# Restore player state
|
||||||
self.saveManager.restore_player_state(self.player, save_data)
|
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)
|
self.game_loop(current_level)
|
||||||
else:
|
else:
|
||||||
messagebox("Failed to load saved level.")
|
messagebox("Failed to load saved level.")
|
||||||
@@ -657,15 +652,6 @@ class WickedQuest:
|
|||||||
|
|
||||||
# Check for death first (following main game loop pattern)
|
# Check for death first (following main game loop pattern)
|
||||||
if self.currentLevel.player.get_health() <= 0:
|
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:
|
if self.currentLevel.player.get_lives() <= 0:
|
||||||
# Game over - stop all sounds
|
# Game over - stop all sounds
|
||||||
|
|||||||
Reference in New Issue
Block a user