Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | quizzcode |
Hello guys !
I’m new to godot and to pyton. I have been following many tutorials, so far so good.
This morning I encountered my first “I can’t solve this” situation.
I’m trying to instance “mob” in order to manage it simple path.
But i keep on getting “null instance on null instance”.
Here is the part of my MAIN :
extends Node2D
onready var mob = preload("res://mob.tscn")
var mobs_remaining = 0
func _ready():
#Level start, let's start the timer :
$mob_spawn_timer.start(1)
mobs_remaining = 5
#Define how many mobs on this wave
func _on_mob_spawn_timer_timeout():
var mob_instance = mob.instance()
#define STARTING position and DESTINATION
mob_instance.position = $start_position.position
mob_instance.destination = $end_position.position
#Define the path it will follow :
var path = $nav.get_simple_path($start_position.position, $end_position.position)
mob_instance.set_path(path)
Now, my path to mob.tscn is res://mob.tscn -
And here is my error feed, opened.
I think I’m probably calling the node wrongly.
I even tried : onready var mob = preload(“res://mob.tscn”) .instance() and same thing.
Any idea ? thanks guys !