Subclass of a scene?

CarlFCarlF Posts: 8Member

So, I created a scene for my (2D) game which is a subclass of Sprite. Essentially it's Sprite, with a script added that makes it draggable during play, and emits a signal when it's being dragged (which is used to update a label that shows range to a stationary object on the map). Another object, basically a graphical menu, allows the player to create an instance of this subclass of Sprite, which can then be dragged to a selected location.

Now, the game should have multiple objects with similar behavior (draggable, range displayed by that same label) but not identical. I'd like to subclass this one and then change the things that should be different by overriding methods and properties of Barricade (the first class). Is there provision in Godot to subclass a user-created subclass of one of the built-in classes? Obviously I could just copy the class and change the properties/methods, but then if I tweak the script it becomes a nightmare.

Thanks.

(Side note: I can't add tags to this system, meaning I can't use the tags "subclass" or "class" or "OOP". Is that deliberate?)


Tags :
Sign In or Register to comment.