forked from team-sg/hero-mark-2
finally make boss-specific stats popup
This commit is contained in:
parent
4068e19857
commit
d7e29f43e8
2 changed files with 152 additions and 15 deletions
|
@ -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,6 +113,10 @@ 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"):
|
||||
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"):
|
||||
|
@ -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,6 +197,11 @@ 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]
|
||||
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
|
||||
|
@ -202,6 +212,7 @@ func _update_stats() -> void:
|
|||
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:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=32 format=2]
|
||||
[gd_scene load_steps=34 format=2]
|
||||
|
||||
[ext_resource path="res://menus/level_select_scholar.gd" type="Script" id=1]
|
||||
[ext_resource path="res://graphics/level_select/world_map.png" type="Texture" id=2]
|
||||
|
@ -131,6 +131,58 @@ tracks/5/keys = {
|
|||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/path = NodePath("BossCenter:visible")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ false ]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/path = NodePath("BossCenter:rect_scale")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=16]
|
||||
resource_name = "hide_boss"
|
||||
length = 0.4
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("BossCenter:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("BossCenter:rect_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.2, 0.4 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 0.04 ), Vector2( 0, 0.04 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=11]
|
||||
resource_name = "hide_exit"
|
||||
|
@ -255,6 +307,34 @@ tracks/1/keys = {
|
|||
"values": [ Vector2( 1, 1 ), Vector2( 1, 0.02 ), Vector2( 0, 0.02 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=17]
|
||||
resource_name = "show_boss"
|
||||
length = 0.4
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("BossCenter:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("BossCenter:rect_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.2, 0.4 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0.04 ), Vector2( 1, 0.04 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=12]
|
||||
resource_name = "show_exit"
|
||||
length = 0.4
|
||||
|
@ -765,11 +845,57 @@ position = Vector2( 31, 71 )
|
|||
texture = ExtResource( 14 )
|
||||
offset = Vector2( 5, 0 )
|
||||
|
||||
[node name="BossCenter" type="CenterContainer" parent="."]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_pivot_offset = Vector2( 128, 96 )
|
||||
|
||||
[node name="BossTimeBox" type="Panel" parent="BossCenter"]
|
||||
margin_left = 68.0
|
||||
margin_top = 71.0
|
||||
margin_right = 188.0
|
||||
margin_bottom = 121.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
rect_min_size = Vector2( 120, 50 )
|
||||
rect_pivot_offset = Vector2( 88, 51 )
|
||||
theme = ExtResource( 4 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="BossCenter/BossTimeBox"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -8.0
|
||||
alignment = 1
|
||||
|
||||
[node name="Header" type="Label" parent="BossCenter/BossTimeBox/VBoxContainer"]
|
||||
material = ExtResource( 6 )
|
||||
margin_top = 5.0
|
||||
margin_right = 104.0
|
||||
margin_bottom = 15.0
|
||||
theme = ExtResource( 4 )
|
||||
text = "Swiftest Slay:"
|
||||
align = 1
|
||||
|
||||
[node name="BossTime" type="Label" parent="BossCenter/BossTimeBox/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
material = ExtResource( 6 )
|
||||
margin_top = 19.0
|
||||
margin_right = 104.0
|
||||
margin_bottom = 29.0
|
||||
text = "0:00.00"
|
||||
align = 1
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/RESET = SubResource( 6 )
|
||||
anims/hide_boss = SubResource( 16 )
|
||||
anims/hide_exit = SubResource( 11 )
|
||||
anims/hide_menu = SubResource( 13 )
|
||||
anims/hide_stats = SubResource( 8 )
|
||||
anims/show_boss = SubResource( 17 )
|
||||
anims/show_exit = SubResource( 12 )
|
||||
anims/show_menu = SubResource( 14 )
|
||||
anims/show_stats = SubResource( 7 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue