end camera preview
This commit is contained in:
parent
22ff2601e5
commit
8463e7cc23
10 changed files with 139 additions and 26 deletions
29
entities/startCounter/StartCounter.tscn
Normal file
29
entities/startCounter/StartCounter.tscn
Normal file
|
@ -0,0 +1,29 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://d453m6wc7v0e"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://egjk6w4jomvk" path="res://entities/startCounter/start_counter.gd" id="1_gfj77"]
|
||||
[ext_resource type="LabelSettings" uid="uid://cru5yoau1mluh" path="res://fonts/BigTextLabelSettings.tres" id="2_xvo28"]
|
||||
|
||||
[node name="StartCounter" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_gfj77")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -11.5
|
||||
offset_right = 20.0
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "3"
|
||||
label_settings = ExtResource("2_xvo28")
|
24
entities/startCounter/start_counter.gd
Normal file
24
entities/startCounter/start_counter.gd
Normal file
|
@ -0,0 +1,24 @@
|
|||
extends Control
|
||||
class_name StartCounter
|
||||
|
||||
@onready var label: Label = $Label
|
||||
@export var car: Car
|
||||
@export var timeManager : TimeManager
|
||||
|
||||
var count_down_started := false
|
||||
var count_down := 3.0
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if !count_down_started: return
|
||||
if count_down < 0:
|
||||
car.freeze = false # Activating car
|
||||
timeManager.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
queue_free() # Delete counter
|
||||
count_down -= delta
|
||||
label.text = str(int(count_down))
|
||||
|
||||
|
||||
|
||||
func _on_camera_3d_preview_ended() -> void:
|
||||
show()
|
||||
count_down_started = true
|
1
entities/startCounter/start_counter.gd.uid
Normal file
1
entities/startCounter/start_counter.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://egjk6w4jomvk
|
Loading…
Add table
Add a link
Reference in a new issue