Godot Version
4
Question
I’ve been trying to get my feet wet with godot 4 by making a simple clone of asteroids and I thought the easiest way to have the asteroids split is just have it insatiate itself twice over and delete the original for that effect. For the life of me I can not get this to work. What’s odd is the bullet code works just as expected I insatiate it and I can access all of its specific variables, its only the asteroid throwing some variation of can not find method or variable depending on what I use. More over the scene itself keeps throwing errors that the scene is either invalid or corrupt. Is this a bug or am I just doing something stupid?
Here is the spawn code
func Spawn_Asteroid(size, direction, speed):
var ast = Ast.instantiate()
get_tree().root.add_child(ast)
ast.start(size,direction,speed)
ast.global_position = global_position
Here is the code for start
func start(size, speed, direction):
Size = size
Direction = direction
Speed = speed
if Size == 3:
Direction = randi_range(0, 359)
Speed = randi_range(50,100)
scale = Vector2.ONE * 0.5 * Size
and to prove I have Ast set
var Ast : PackedScene = preload("res://Objects/Asteroid/Asteroid.tscn")
With this code it keeps throwing Invalid call. Nonexistant function ‘start’ in base 'Area2D