
I have tangled myself up a bit!
If you watch the clip, I have this animation in a scene, placed in a main scene.
Imagine halfway through this animation, another section appears at the tip (still moving until the animation finishes), and repeats as if the thing was growing a new section several times. This is my end goal!
var newBone = preload("res://Src/Platforms/Bambone/BamboneTest.tscn").instance()
export var NumberOfIterations :int = 4
var CurrentIterations :int = 0
func _ready():
pass
func _unhandled_input(_event):
if CurrentIterations < NumberOfIterations:
if Input.is_mouse_button_pressed(1) and not $BamboneTest/AnimationPlayer.is_playing():
$BamboneTest/AnimationPlayer.play("Spawn_Point")
CurrentIterations += 1
print("Iteration ", CurrentIterations)
get_tree().get_root().add_child(newBone)
newBone.position = $BamboneTest/SpawnPoint.position
else:
pass
func _process(delta):
print($BamboneTest/SpawnPoint.position)
pass
The animation scene has a ‘spawn point’, where I want the new instance to appear, but it doesnt appear with this line….
newBone.position = $BamboneTest/SpawnPoint.position
though trying to check the position in the process part with the print statement, this does show the changing position co ordinates of the ’SpawnPoint’
The new instance seems to just replace the original animation, not add another one, and in the editor window scene tree remote part, only ONE instance seems to be made, despite trying to do several iterations, from a mouse click….
I know Im waaaaaay off the mark for getting this right, but Im now very stuck!
any help welcomed! 🙂