![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Criepstar |
So I’m trying to make an Endless Runner
In this video, I’m showing my problem.
So the ,Tiles’’ or Objects move to a certain point. It isnt a collision or like that, because the objects dont have a collision yet.
There is an error in the second window of godot(the cmd) wich says WARNING: add_child_below_node: Cannot move under node Spawner as @ObjectsA@6 does not share a parent.
At: scene/main/node.cpp:1195
My code for the movement is
extends Node2D
export var speed = 5
func _ready():
pass # Replace with function body.
func move():
self.position.y = speed
and the script for the spawning is under a Node2D:
extends Node2D
export (Array, PackedScene) var scenes
var random_scene = RandomNumberGenerator.new()
var selected_scene_index = 0
var timer
func _on_Timer_timeout():
random_scene.randomize()
selected_scene_index = random_scene.randi_range(0, scenes.size()-1)
var tmp = scenes[selected_scene_index].instance()
add_child_below_node(self, tmp)
func _ready():
timer = get_node("Timer")
timer.set_wait_time(1)
timer.start()
So whats the problem?
If other info is needed for answering, just write it