title screen
This commit is contained in:
parent
2fd199612b
commit
d464e0499b
12 changed files with 147 additions and 7 deletions
|
|
@ -1,5 +1,6 @@
|
|||
[gd_scene format=3 uid="uid://f2gxwphgniru"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://vfvpb7ptujn0" path="res://levels/level.gd" id="1_63c5o"]
|
||||
[ext_resource type="PackedScene" uid="uid://cv5p3w87nk0wn" path="res://player/player.tscn" id="1_wevqg"]
|
||||
[ext_resource type="Script" uid="uid://bayj73ugmsbd" path="res://levels/enemy_spawner.gd" id="2_ew5uy"]
|
||||
|
||||
|
|
@ -11,6 +12,7 @@ geometry_source_geometry_mode = 1
|
|||
agent_radius = 1.0
|
||||
|
||||
[node name="BaseLevel" type="Node3D" unique_id=815380624]
|
||||
script = ExtResource("1_63c5o")
|
||||
|
||||
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="." unique_id=845356554]
|
||||
visible = false
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ func _process(_delta: float) -> void:
|
|||
doomed_point_idx = doomed_point_idx % MAX_CACHED_POINTS
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
if not Level.is_active(): return
|
||||
if points.is_empty():
|
||||
push_warning("tried to spawn enemy, but can't find a point!")
|
||||
return
|
||||
|
|
|
|||
25
levels/level.gd
Normal file
25
levels/level.gd
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
class_name Level
|
||||
extends Node3D
|
||||
|
||||
signal level_started
|
||||
|
||||
static var level: Level
|
||||
|
||||
@export var active := false
|
||||
var start_time_msec := 0
|
||||
|
||||
static func start_game() -> void:
|
||||
if level:
|
||||
level.active = true
|
||||
level.level_started.emit()
|
||||
level.start_time_msec = Time.get_ticks_msec()
|
||||
|
||||
|
||||
static func is_active() -> bool:
|
||||
if level:
|
||||
return level.active
|
||||
else:
|
||||
return false
|
||||
|
||||
func _ready() -> void:
|
||||
level = self
|
||||
1
levels/level.gd.uid
Normal file
1
levels/level.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://vfvpb7ptujn0
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue