0 votes

Does Godot allow you to extend base classes?

can I write code for something like

Vector2.random_angle()

asked Jan 18 in Engine by hamoom (35 points)

1 Answer

+3 votes
Best answer

No, you can't extend a base class.

An option: you could define some static functions in a singleton.

static func vector_random_angle(vector):
    return vector.rotated(rand_range(0, 2*PI))
answered Jan 18 by kidscancode (17,762 points)
selected Jan 19 by hamoom
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.