Animations with custom drawings?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By al.glez
:warning: Old Version Published before Godot 3 was released.

I’m using custom drawings for almost everything in one project I’m working on. Until now I have used linear velocity etc. But now I need to create some kind of small animations that disappear after some time. For example an small animation when the player touch the screen (longer than the actual touch).

I don’t know what is the best method to do this, and I would like to know if it is a better method that the ones I can think of:

  • Add child to that exact animation with a timer. I should “deactivate” the child after the times consume (or other conditional). I’m not sure how to do this exactly, but seems to be the best approach.
  • Create a conditional inside a _draw():. I don’t like that much this approache because I maybe I need more than one animation at a time, and should check that condition every frame.

Note that _draw is called not every frame, but only after (but not immediately after) update() is called.

Bojidar Marinov | 2016-04-22 10:51

Yes I know, I simplified because since I’m using already a lot of custom drawing I need to use a new _draw(): function or the ones I’m already using.

al.glez | 2016-04-22 16:04

:bust_in_silhouette: Reply From: al.glez

I think the best way to do this is create an instance of an scene and add it as a child:

For example:

	anim = preload("res://winanim.scn").instance()

And in the node free that node when necessary, for example with a timer

	var timer =
timer.set_wait_time(3) # time in secondn

There are probably other better solutions, but this one seems not that bad. You can also quit that scene with


at any point.

reddit source