This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes
extends Ship
class_name Enemy

onready var timer = get_node("Timer")

error (6,1): The method "get_node" isn't declared in the current class.

The Ship class in my code extends KinematicBody2D, and is not attached to any actual node in the scene tree (though for what I understand that shouldn't be a problem). The Enemy script is sitting on a KinematicBody2D node in my scene.

I checked and found out that the problem is still there for methods other than just getnode (lookat doesn't work either).

I've already tried restarting Godot in case it just didn't update everything correctly but the problem is still there.

Godot version 3.4
in Engine by (24 points)

1 Answer

+4 votes

I managed to solve it. The problem was that the super class (the Ship class in my code) had an unsolved syntax error in it. Therefore, it didn't save properly, and the subclass wasn't able to acces it.

I'll leave this here for anyone who might be dealing with the same sort of problem.

by (24 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 Frequently asked questions and 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 [email protected] with your username.