Added deleting (#25)

This commit is contained in:
Rafał Mikrut 2021-02-13 13:44:18 +01:00 committed by GitHub
parent 4797415d24
commit 0e626eeff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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