finally make boss-specific stats popup

This commit is contained in:
Haze Weathers 2024-07-07 16:26:36 -04:00
parent 4068e19857
commit d7e29f43e8
2 changed files with 152 additions and 15 deletions

View file

@ -7,6 +7,7 @@ var made_selection: bool = false
var selected_shard: int = 0
var tween: SceneTreeTween = null
var hop_tween: SceneTreeTween = null
var boss_shown: bool = false
onready var level_path: Path2D = $LevelPath
onready var player_position: PathFollow2D = $"%PlayerPosition"
@ -20,6 +21,7 @@ onready var score_any: Label = $"%ScoreAny"
onready var time_any: Label = $"%TimeAny"
onready var score_100: Label = $"%Score100"
onready var time_100: Label = $"%Time100"
onready var boss_time: Label = $"%BossTime"
onready var filled_shards: Node2D = $"%FilledShards"
onready var shard_title: Label = $"%ShardTitle"
onready var shard_arrow: Sprite = $"%ShardArrow"
@ -97,7 +99,6 @@ func _gui_input(event: InputEvent) -> void:
if not made_selection: # player is walking around
if event.is_action_pressed("ui_accept"):
_update_stats()
animation_player.play("show_stats")
made_selection = true
elif event.is_action_pressed("ui_right"):
var level = int(clamp(selected_level + 1, 0, LevelData.levels.size() - 1))
@ -112,7 +113,11 @@ func _gui_input(event: InputEvent) -> void:
Game.current_level = selected_level
Game.change_map(LevelData.levels[selected_level].scene)
elif event.is_action_pressed("ui_cancel"):
animation_player.play("hide_stats")
if boss_shown:
animation_player.play("hide_boss")
boss_shown = false
else:
animation_player.play("hide_stats")
made_selection = false
elif event.is_action_pressed("ui_right"):
selected_shard = posmod(selected_shard + 1, 8)
@ -139,13 +144,13 @@ func _select_level(level_id: int) -> void:
# set text
level_title.text = level.title
#set world name
print(selected_level)
if selected_level < 2: world_title.text = "Garden of love:\nremnants of nature's beauty"
if selected_level < 3: world_title.text = "Garden of love:\nremnants of nature's beauty"
if selected_level == 3: world_title.text = "Artificial life:\namalgam, stranger to the gods"
if selected_level > 3 && selected_level < 7: world_title.text = "Harsh Reality:\nHappiness through Hardship"
if selected_level == 7: world_title.text = "Dr.Intelli the Vengeful monster:\nfriend to no one, cold metal prison"
if selected_level > 7 && selected_level < 11: world_title.text = "Artificial world:\nend man-made suffering"
if selected_level == 11: world_title.text = "This is it SG...\nchange the future, we believe in you"
if selected_level > 11: world_title.text = "Great Job!\nwelcome to bonus land!"
# initiate animation
_travel_to_level(level.save_id)
@ -192,16 +197,22 @@ func _update_stats() -> void:
# fill in level panel information
var save_id = LevelData.levels[selected_level].save_id
var save_data: Save.LevelSaveData = Save.current_file.levels[save_id]
score_any.text = "%05d" % save_data.score_any
time_any.text = Game.format_time(save_data.time_any)
score_100.text = "%05d" % save_data.score_100
time_100.text = Game.format_time(save_data.time_100)
var shards = filled_shards.get_children()
for i in 8:
shards[i].visible = save_data.shards_collected[i]
selected_shard = 0
shard_title.text = LevelData.levels[selected_level].shard_titles[selected_shard]
shard_arrow.position.x = filled_shards.get_child(selected_shard).position.x
if LevelData.levels[selected_level].boss:
boss_time.text = Game.format_time(save_data.time_any)
animation_player.play("show_boss")
boss_shown = true
else:
score_any.text = "%05d" % save_data.score_any
time_any.text = Game.format_time(save_data.time_any)
score_100.text = "%05d" % save_data.score_100
time_100.text = Game.format_time(save_data.time_100)
var shards = filled_shards.get_children()
for i in 8:
shards[i].visible = save_data.shards_collected[i]
selected_shard = 0
shard_title.text = LevelData.levels[selected_level].shard_titles[selected_shard]
shard_arrow.position.x = filled_shards.get_child(selected_shard).position.x
animation_player.play("show_stats")
func _on_StayHere_pressed() -> void: