0 votes

E 0:00:01.729 get_node: Node not found: StartPosition.
<C++ Error> Condition "!node" is true. Returned: __null
<C++ Source> scene/main/node.cpp:1381 @ get_node()
Main.gd:13 @ new_game()
Main.gd:10 @ _ready()

This Is The Error

    extends Node

var Circle = preload("res://objects/Circle.tscn")
var Jumper = preload("res://objects/Jumper.tscn")

var player

func _ready():

func new_game():
    $Camera2D.position = $StartPosition.position
    player = Jumper.instance()
    player.position = $StartPosition.position
    player.connect("captured", self, "_on_Jumper_captured")

func spawn_circle(_position=null):
    var c = Circle.instance()
    if !_position:
        var x = rand_range(-150, 150)
        var y = rand_range(-500, -400)
        _position = player.target.position + Vector2(x, y)

func _on_Jumper_captured(object):
    $Camera2D.position = object.position

This Is The Code PLSS HELP!!

in Engine by (12 points)

2 Answers

+1 vote

It looks like line 13 is this one:

$Camera2D.position = $StartPosition.position

It seems that one of those nodes doesn't exist. Check the name/spelling of your nodes.

by (20,675 points)
–1 vote

I think all you gotta do is to swap these 2 lines of code:

player.position = $StartPosition.position

The error occured, because you were trying to set a property of a nide that hasn't been instanced yet. You just stored it in a varaiable. Sequence matters ;)

by (137 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.