workers running toward factory
This commit is contained in:
parent
113c2eca4d
commit
2603ee53a0
@ -1,21 +1,30 @@
|
||||
extends Spatial
|
||||
|
||||
const SPAWN_TIME_MIN = 3000 # min spawntime in ms
|
||||
const SPAWN_TIME_MAX = 7000 # max spawntime in ms
|
||||
export(NodePath) var _nodepath
|
||||
export(float) var _offset
|
||||
|
||||
const SPAWN_TIME_MIN = 5000 # min spawntime in ms
|
||||
const SPAWN_TIME_MAX = 8000 # max spawntime in ms
|
||||
|
||||
var _worker
|
||||
var _lastSpawn = 0 # timestamp of last spawned worker
|
||||
var _path: Path
|
||||
|
||||
func _ready():
|
||||
_worker = load("res://Characters/Worker/Worker.tscn")
|
||||
assert(null != _worker)
|
||||
|
||||
_path = get_node(_nodepath)
|
||||
assert(null != _path)
|
||||
|
||||
func _process(delta):
|
||||
# spawns new workers after defined time
|
||||
var cur_time = OS.get_ticks_msec()
|
||||
var diff = rand_range(SPAWN_TIME_MIN, SPAWN_TIME_MAX)
|
||||
if cur_time - _lastSpawn > diff:
|
||||
#Logger.info(name + " spawning new worker")
|
||||
var new_worker = _worker.instance()
|
||||
add_child(new_worker)
|
||||
var pathFollow = PathFollow.new()
|
||||
pathFollow.offset = _offset
|
||||
pathFollow.add_child(_worker.instance())
|
||||
_path.add_child(pathFollow)
|
||||
_lastSpawn = cur_time
|
||||
|
200
Level/World.tscn
200
Level/World.tscn
File diff suppressed because one or more lines are too long
@ -4,20 +4,19 @@
|
||||
[ext_resource path="res://UI/PlayButton.gd" type="Script" id=2]
|
||||
[ext_resource path="res://UI/ExitButton.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
size = 180
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 32
|
||||
size = 180
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
size = 32
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "Text"
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
size = 32
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
length = 5.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("ForegroundGoesUp:rect_position")
|
||||
@ -86,7 +85,7 @@ margin_left = 1.0
|
||||
margin_top = -1.16635
|
||||
margin_right = 1025.0
|
||||
margin_bottom = 398.834
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_colors/font_color_shadow = Color( 1, 0, 0, 1 )
|
||||
custom_constants/shadow_offset_x = 4
|
||||
@ -111,7 +110,7 @@ margin_left = 380.0
|
||||
margin_top = 410.0
|
||||
margin_right = 620.0
|
||||
margin_bottom = 470.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_colors/font_color_hover = Color( 0.980392, 0.839216, 0.619608, 1 )
|
||||
text = "Embark"
|
||||
@ -123,7 +122,7 @@ margin_left = 380.0
|
||||
margin_top = 470.0
|
||||
margin_right = 620.0
|
||||
margin_bottom = 530.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
text = "Disembark"
|
||||
flat = true
|
||||
@ -131,6 +130,6 @@ script = ExtResource( 3 )
|
||||
|
||||
[node name="AnimateForeground" type="AnimationPlayer" parent="."]
|
||||
autoplay = "Text"
|
||||
anims/Text = SubResource( 3 )
|
||||
anims/Text = SubResource( 4 )
|
||||
[connection signal="pressed" from="PlayButton" to="PlayButton" method="_on_PlayButton_pressed"]
|
||||
[connection signal="pressed" from="ExitButton" to="ExitButton" method="_on_ExitButton_pressed"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user