+1 vote

I need to draw a custom complex animation in several parts of the game; for completely different objects (once for the player in the world, multiple times for the life display, as they share the same mentioned animation).

For that, I wanted to wrap the animation drawing code in a method in an AutoLoad class which I can then just call in the _draw methods of my player object / life display object.

However, that didn't work out. When calling the custom draw function of the AutoLoad class, using draw_texture_rect methods inside of it fails saying I'm not in the drawing context.

How would someone create re-usable, custom drawing methods which are globally accessible?

asked Apr 30, 2016 in Engine by Ray Koopa (161 points)

did you tried to pass the concerned node and call node.draw_texture_rect() instead?

Yeah, that was the first idea I had, still the same error. (I solved it differently now, lowers my personal priority on this, though a solution would be interesting...)

Please log in or register to answer this question.

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.