diff --git a/Autoload/Autoload.gd b/Autoload/Autoload.gd index a4d85b9..1731cc7 100644 --- a/Autoload/Autoload.gd +++ b/Autoload/Autoload.gd @@ -37,13 +37,13 @@ func _init(): start_time = OS.get_ticks_msec() # In case when user doesn't provide time - time_for_each_step = time_to_show / (alone_steps.size() + 1) + time_for_each_step = time_to_show / (alone_steps.size()) for argument in OS.get_cmdline_args(): if argument.is_valid_float(): # Ignore all non numeric arguments time_to_show = int(argument.to_float() * 1000) - time_for_each_step = time_to_show / (alone_steps.size() + 1) - print("Time set to: " + str(time_to_show / 1000.0) + " seconds with "+ str(alone_steps.size() + 1) + " steps, each step will take " + str(time_for_each_step / 1000.0) + " seconds.") + time_for_each_step = time_to_show / (alone_steps.size()) + print("Time set to: " + str(time_to_show / 1000.0) + " seconds with "+ str(alone_steps.size()) + " steps, each step will take " + str(time_for_each_step / 1000.0) + " seconds.") break # We only need to take first argument diff --git a/MainScenes/Control.gd b/MainScenes/Control.gd index 8498e08..eeeb194 100644 --- a/MainScenes/Control.gd +++ b/MainScenes/Control.gd @@ -1,7 +1,10 @@ extends GridContainer -func _ready() -> void: - for _i in range(10): +var TIME_TO_DELETE : float = 1.0 +var time_to_delete : float = TIME_TO_DELETE + +func _populate() -> void: + for _i in range(4): add_child(Control.new()) add_child(Popup.new()) add_child(WindowDialog.new()) @@ -58,8 +61,20 @@ func _ready() -> void: add_child(Tree.new()) add_child(VideoPlayer.new()) +func _ready() -> void: + _populate() -func _process(_delta: float) -> void: +func _process(delta: float) -> void: for i in get_children(): if i is Control: i._set_size(Vector2(200 * randf() - 100, 200 * randf() - 100)) + + time_to_delete -= delta + if time_to_delete < 0: + time_to_delete += TIME_TO_DELETE + + for i in get_children(): + i.queue_free() + + _populate() + diff --git a/MainScenes/Node2D.gd b/MainScenes/Node2D.gd index b2948c0..99d0feb 100644 --- a/MainScenes/Node2D.gd +++ b/MainScenes/Node2D.gd @@ -1,7 +1,10 @@ extends Node2D -func _ready() -> void: - for _i in range(10): +var TIME_TO_DELETE : float = 1.0 +var time_to_delete : float = TIME_TO_DELETE + +func _populate() -> void: + for _i in range(4): add_child(Node2D.new()) add_child(AnimatedSprite.new()) add_child(Area2D.new()) @@ -42,8 +45,20 @@ func _ready() -> void: add_child(VisibilityEnabler2D.new()) add_child(YSort.new()) +func _ready() -> void: + _populate() -func _process(_delta: float) -> void: +func _process(delta: float) -> void: for i in get_children(): if i is Node2D: i.set_position(Vector2(1000 * randf() - 500, 1000 * randf() - 500)) + + time_to_delete -= delta + if time_to_delete < 0: + time_to_delete += TIME_TO_DELETE + + for i in get_children(): + i.queue_free() + + _populate() + diff --git a/MainScenes/Other.gd b/MainScenes/Other.gd index 068e1dc..d0a42b1 100644 --- a/MainScenes/Other.gd +++ b/MainScenes/Other.gd @@ -1,8 +1,10 @@ extends Node +var TIME_TO_DELETE : float = 1.0 +var time_to_delete : float = TIME_TO_DELETE -func _ready() -> void: - for _i in range(10): +func _populate() -> void: + for _i in range(4): add_child(AnimationPlayer.new()) add_child(AnimationTree.new()) add_child(AnimationTreePlayer.new()) @@ -16,3 +18,16 @@ func _ready() -> void: add_child(Tween.new()) add_child(Viewport.new()) add_child(WorldEnvironment.new()) + +func _ready() -> void: + _populate() + +func _process(delta: float) -> void: + time_to_delete -= delta + if time_to_delete < 0: + time_to_delete += TIME_TO_DELETE + + for i in get_children(): + i.queue_free() + + _populate() diff --git a/MainScenes/Spatial.gd b/MainScenes/Spatial.gd index 68407e5..d448168 100644 --- a/MainScenes/Spatial.gd +++ b/MainScenes/Spatial.gd @@ -1,8 +1,10 @@ extends Spatial +var TIME_TO_DELETE : float = 1.0 +var time_to_delete : float = TIME_TO_DELETE -func _ready() -> void: - for _i in range(10): +func _populate() -> void: + for _i in range(4): add_child(Spatial.new()) add_child(ARVRAnchor.new()) add_child(Camera.new()) @@ -63,9 +65,20 @@ func _ready() -> void: add_child(VisibilityNotifier.new()) add_child(VisibilityEnabler.new()) +func _ready() -> void: + _populate() func _process(delta: float) -> void: for i in get_children(): if i.get_name() != "Camera": i.set_scale(Vector3(delta + 1, delta + 1, delta + 1)) i.set_translation(Vector3(10 * randf(), 10 * randf(), 10 * randf())) + + time_to_delete -= delta + if time_to_delete < 0: + time_to_delete += TIME_TO_DELETE + + for i in get_children(): + i.queue_free() + + _populate() diff --git a/Start.gd b/Start.gd index 9186a3c..49ede83 100644 --- a/Start.gd +++ b/Start.gd @@ -8,7 +8,7 @@ var array_with_time_to_change : Array = [] func _ready(): for i in Autoload.alone_steps.size() + 1: - array_with_time_to_change.append(OS.get_ticks_msec() + (i + 1) * Autoload.time_for_each_step) + array_with_time_to_change.append(OS.get_ticks_msec() + i * Autoload.time_for_each_step) print("Starting with scene(s):") for path in Autoload.all_in_one: