Add shoot to start game label

This commit is contained in:
Antimundo 2023-11-12 19:19:35 +01:00
parent 88b292ced4
commit 0799b54e7a
No known key found for this signature in database
GPG key ID: F83F260F8F88F0BC
2 changed files with 72 additions and 6 deletions

View file

@ -13,6 +13,7 @@ var id_spawn_target = 0
# Called when the node enters the scene tree for the first time.
func _ready():
timer.wait_time = 60
captured_needed.visible = false
id_spawn_target = 0
count_kills = 0
@ -21,7 +22,10 @@ func _ready():
spawn_target()
func _process(_delta):
update_timer_ui()
if timer.is_stopped():
update_timer_ui(timer.wait_time)
else:
update_timer_ui(timer.time_left)
func _on_mouse_captured_needed_pressed():
get_tree().paused = false
@ -33,9 +37,9 @@ func _on_timer_timeout():
get_tree().change_scene_to_file("res://scenes/main_menu/main_menu.tscn")
func _on_player_shoot():
if (timer.is_stopped()):
timer.wait_time = 60
if timer.is_stopped():
timer.start()
$CanvasLayer/GameplayUI/PressAny.queue_free()
func _on_target_destroyed():
messageHit()
@ -85,5 +89,5 @@ func messageHit():
if not animation_kill.is_playing():
animation_kill.play("kill")
func update_timer_ui():
timer_label.set_text("%.f s" % timer.time_left)
func update_timer_ui(time_left):
timer_label.set_text("%.f s" % time_left)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=3 uid="uid://cdbhv0p0jfr75"]
[gd_scene load_steps=26 format=3 uid="uid://cdbhv0p0jfr75"]
[ext_resource type="Script" path="res://scenes/game_world/game_world.gd" id="1_4pv4x"]
[ext_resource type="Material" uid="uid://dsqe2mx1kgicf" path="res://assets/images/mat_filldummy.tres" id="2_ldkna"]
@ -106,6 +106,44 @@ _data = {
"kill": SubResource("Animation_jsqua")
}
[sub_resource type="Animation" id="Animation_8c12g"]
resource_name = "idle"
length = 2.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(-2, -2),
"update": 0,
"values": [Vector2(1, 1), Vector2(1.05, 1.05)]
}
[sub_resource type="Animation" id="Animation_ybjr1"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_y2pta"]
_data = {
"RESET": SubResource("Animation_ybjr1"),
"idle": SubResource("Animation_8c12g")
}
[node name="World" type="Node3D"]
script = ExtResource("1_4pv4x")
@ -309,6 +347,30 @@ libraries = {
"": SubResource("AnimationLibrary_s0jl0")
}
[node name="PressAny" type="Label" parent="CanvasLayer/GameplayUI"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -269.5
offset_top = -318.0
offset_right = 269.5
offset_bottom = -257.0
grow_horizontal = 2
grow_vertical = 0
pivot_offset = Vector2(269, 30)
text = "Shoot to start"
horizontal_alignment = 1
vertical_alignment = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="CanvasLayer/GameplayUI/PressAny"]
autoplay = "idle"
libraries = {
"": SubResource("AnimationLibrary_y2pta")
}
[node name="PauseManager" type="Node" parent="CanvasLayer"]
script = ExtResource("7_ffgmh")