This commit is contained in:
Ententerminator 2020-01-27 00:03:25 +01:00
commit 00ec79dd53
16 changed files with 4218 additions and 111 deletions

View File

@ -11,6 +11,7 @@ func _ready():
func _process(delta):
# Taking a pill
if Input.is_action_just_pressed("take_pill"):
Pills.take_pill()
#Logger.info("Player took a pill, new level: %s" % [Pills.get_round_level()])
_animation.play("PillTaking")
_animation.play("PillTaking")
yield(_animation, "animation_finished")
Pills.take_pill()

View File

@ -1,11 +1,22 @@
extends NPC
const diffPerSecond = 5
var _arrived_distance_threshold = 0.1
var _interactArea: Area
var _navPath: Path
var _followPath: PathFollow
var _current_nav_index = 0
func _ready():
#Logger.set_logger_level(Logger.LOG_LEVEL_FINE)
_followPath = get_node("../") as PathFollow
assert(null != _followPath)
_navPath = get_node("../../") as Path
assert(null != _navPath)
var _interactArea = get_node("InteractArea") as Area
assert(null != _interactArea)
_interactArea.connect("area_entered", self, "_on_area_entered")
@ -13,11 +24,10 @@ func _ready():
func _process(_delta):
# TODO: movement
#if current_target: # should not be needed -> handled per navigation path
pass
_followPath.offset += diffPerSecond * _delta
func _on_area_entered (area: Area):
if area.is_in_group("FactoryEntry"):
# despawn
queue_free()
pass
queue_free()

View File

@ -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

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -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"]