shard titles pop up in game

This commit is contained in:
pennyrigate 2023-05-20 21:01:41 -04:00
parent a13a9cee10
commit afa641901c
10 changed files with 108 additions and 8 deletions

View file

@ -1,14 +1,19 @@
extends Node2D
signal collected(shard_number)
export var value = 1
export var number = 0 #Used for saving which specific shards collected
func _ready():
var hud = get_tree().get_nodes_in_group("hud").pop_back()
connect("collected",hud,"shard_popup")
$AnimationPlayer.play("glow")
func _on_Area2D_body_entered(body):
#Collect
if body.is_in_group("player"):
emit_signal("collected",number)
Audio.play_shard_sound()
Game.score += 500
Game.shards += value

View file

@ -32,6 +32,17 @@ func _ready():
tween.tween_interval(3.0)
tween.tween_property(music, "rect_position:x", 256.0, 1.0)
func shard_popup(shard_number):
#Change text to song name
var shard_title = $ShardTitle
var level = LevelData.levels[Game.current_level]
shard_title.text = "§" + str(level.shard_titles[shard_number])
yield(get_tree(), "idle_frame")
var tween = create_tween()
tween.tween_property(shard_title, "rect_position:x", 254.0 - shard_title.rect_size.x, 1.0)
tween.tween_interval(3.0)
tween.tween_property(shard_title, "rect_position:x", 256.0, 1.0)
func _physics_process(delta):
#Gold Counter
gold_counter.text = "%02d" % Game.keys

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=14 format=2]
[ext_resource path="res://graphics/hud/stars_hud.png" type="Texture" id=1]
[ext_resource path="res://graphics/hud/lives_head.png" type="Texture" id=2]
@ -8,17 +8,21 @@
[ext_resource path="res://objects/hud/hud.gd" type="Script" id=6]
[ext_resource path="res://graphics/hud/key_counter.png" type="Texture" id=7]
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=8]
[ext_resource path="res://ui/2ndpuberty_no_dropshadow.tres" type="Theme" id=9]
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=9]
[ext_resource path="res://ui/theme.tres" type="Theme" id=10]
[sub_resource type="ShaderMaterial" id=1]
[sub_resource type="ShaderMaterial" id=2]
[node name="HUD" type="CanvasLayer"]
[sub_resource type="ShaderMaterial" id=3]
shader = ExtResource( 9 )
shader_param/border_color = Color( 0.219608, 0.219608, 0.219608, 1 )
shader_param/border_corners = true
[node name="HUD" type="CanvasLayer" groups=["hud"]]
layer = 100
script = ExtResource( 6 )
song_name = "♫Music"
bonus_color = Color( 0.478431, 1, 0.47451, 1 )
[node name="Back" type="Sprite" parent="."]
@ -156,6 +160,16 @@ anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -10.0
margin_right = 42.0
theme = ExtResource( 9 )
theme = ExtResource( 10 )
text = "♫Music"
align = 2
[node name="ShardTitle" type="Label" parent="."]
material = SubResource( 3 )
margin_left = 256.0
margin_top = 182.0
margin_right = 333.0
margin_bottom = 192.0
theme = ExtResource( 10 )
text = "§time bonus"
align = 2

View file

@ -1157,8 +1157,8 @@ script = ExtResource( 8 )
[connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Still" to="." method="_on_Still_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Walking" to="." method="_on_Walking_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Blinking" to="." method="_on_Blinking_state_entered"]
@ -1168,8 +1168,8 @@ script = ExtResource( 8 )
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/Pushing" to="." method="_process_pushing"]
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne" to="." method="_on_Airborne_state_entered"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne" to="." method="_process_gravity"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_horizontal_movement"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_jump"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_horizontal_movement"]
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_entered"]
[connection signal="state_exited" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_exited"]
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/LadderJump" to="." method="_on_LadderJump_state_entered"]