Added Death Counter to Custom Levels + Fixed castle bridge axe bonus sprites

This commit is contained in:
JHDev2006
2025-10-01 10:58:20 +01:00
parent fa4c1c711c
commit 51d81844d0
11 changed files with 308 additions and 267 deletions

View File

@@ -560,6 +560,7 @@ func die(pit := false) -> void:
Global.p_switch_active = false
Global.p_switch_timer = 0
stop_all_timers()
Global.total_deaths += 1
sprite.process_mode = Node.PROCESS_MODE_ALWAYS
state_machine.transition_to("Dead", {"Pit": pit})
process_mode = Node.PROCESS_MODE_ALWAYS
@@ -584,7 +585,7 @@ func death_load() -> void:
Global.death_load = true
# Handle lives decrement for CAMPAIGN and MARATHON
if [Global.GameMode.CAMPAIGN, Global.GameMode.MARATHON].has(Global.current_game_mode):
if [Global.GameMode.CAMPAIGN, Global.GameMode.MARATHON, Global.GameMode.LEVEL_EDITOR, Global.GameMode.CUSTOM_LEVEL].has(Global.current_game_mode):
if Settings.file.difficulty.inf_lives == 0:
Global.lives -= 1

View File

@@ -62,6 +62,8 @@ var debugged_in := true
var score_tween = create_tween()
var time_tween = create_tween()
var total_deaths := 0
var score := 0:
set(value):
if disco_mode == true:
@@ -304,6 +306,7 @@ func reset_values() -> void:
PlayerGhost.idx = 0
Checkpoint.passed_checkpoints.clear()
Checkpoint.sublevel_id = 0
Global.total_deaths = 0
Door.unlocked_doors = []
Checkpoint.unlocked_doors = []
KeyItem.total_collected = 0

View File

@@ -77,7 +77,9 @@ func _ready() -> void:
SaveManager.write_save(Global.current_campaign)
DiscordManager.set_discord_status("Playing " + Global.current_campaign + ": " + str(world_num) + "-" + str(Global.level_num))
$BG/Control/WorldNum.text = str(world_num) +"-" + str(Global.level_num)
if Settings.file.difficulty.inf_lives:
if [Global.GameMode.CUSTOM_LEVEL, Global.GameMode.LEVEL_EDITOR].has(Global.current_game_mode):
$BG/Control/LivesCount.text = "☠ * " + str(Global.total_deaths)
elif Settings.file.difficulty.inf_lives:
$BG/Control/LivesCount.text = "* ∞"
elif Global.lives < 100:
$BG/Control/LivesCount.text = "* " + (str(Global.lives).lpad(2, " "))

View File

@@ -78,7 +78,6 @@ func edit_level() -> void:
func play_level() -> void:
Global.current_game_mode = Global.GameMode.CUSTOM_LEVEL
Settings.file.difficulty.inf_lives = 1
LevelEditor.load_play = true
$CharacterSelect.open()
await $CharacterSelect.selected
@@ -88,7 +87,6 @@ func play_level() -> void:
func online_play() -> void:
lss_level_played()
Global.current_game_mode = Global.GameMode.CUSTOM_LEVEL
Settings.file.difficulty.inf_lives = 1
LevelEditor.load_play = true
$LSSCharacterSelect.open()
await $LSSCharacterSelect.selected

View File

@@ -48,6 +48,10 @@ func setup_rating_stars() -> void:
var rating = calculate_rating()
var idx := 0
if ratings.is_empty():
for i in %RatingStars.get_children():
i.region_rect.position.x = 16
return
for i in %RatingStars.get_children():
i.region_rect.position.x = 16 if idx > rating else (0 if abs(idx - rating) >= 0.5 else 8)
idx += 1