I'd like some assistance with lightning in hoppy days

(This is the same question I asked on discord, but I hadn’t gotten any responses so I thought I’d try here)

Hello, I was working on the Hoppy Days project and was adding the lighting’s script, I’ve run into an error and I don’t know what I did to cause it the code:

extends Node

func _ready():
    set_as_toplevel(true)
    global_position = get_parent().global_position

The error:

Parser Error: The method "set_as_toplevel" isn't declared in the current class.

I have the same code as shown in the lesson, not sure where I went wrong. Could anyone help me out?

Ah is this the one we just solved on Discord?
do apologise, was away for a bit. but firstly… welcome to the community :wave:

just for reference for others
set_as_toplevel() isnt available whilst extending from Node.
this is due to Node having no spacial or transform properties and doesnt have this method within it.

so changing this to

extends Node2D

allows for the Node2D method calls to be used and this then works.

i know from speaking with you earlier that this is now working ok, could you mark this one as solved please Jayden, that would be great :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms