![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | kingbard |
Hi,
I am new to Godot so I am sure I am making a simple, stupid mistake, any help is much appreciated.
I am trying to make a node that regularly spawns platforms off screen that will move until they are queue_freed when they make it to the other side of the screen. I am having difficulty when trying to call the .instance method.
I have tried a few different ways to call the floor node variable into the spawning script to no avail. Please help!
I am receiving the following error when trying to instance new platforms:
Invalid call. Nonexistant function ‘insance’ in base ‘RigidBody2D’
Godot version: 3.2.1.stable.official
Local Tree:
- FloorSpawn (Node2D)
---- Timer
---- Floor (RigidBody2D)
Script (attached to node root):
extends Node2D
onready var new_floor = $Floor
func _on_Timer_timeout():
var new_floori = new_floor.instance()
add_child(new_floori)
Floor.gd:
extends RigidBody2D
export var speed = -100
func _physics_process(delta):
move_local_y(delta * speed)
func _on_DieArea_area_entered(area):
queue_free()