0 votes

I want a white water ripple effect like circle to appear where I right clicked. I can draw the effect myself.
How do I make it appear? Do I make it a scene and instance it where I clicked. And I could just put a queue_free at the end of it's animation to delete it.
But is there another perhaps better way using the UI system?

Godot version 3.4.4
in Engine by (202 points)

Have you looked into using a CanvasLayer for this effect? Have the CanvasLayer play the ripple effect at the place the player clicks, and hide the CanvasLayer when it finishes playing.

Thanks for the suggestion. I will check out some canvas layer tutorials.

1 Answer

+1 vote
Best answer

If I understand you right, you want to spawn an object when you click. Then this:

var splash_scene = preload("drag_your_tscn_scene_from_the bottom_left_window_to_here")

func _input(event):
    if event is InputEventMouseButton:
        var splash = splash_scene.instance()
        splash.position = event.position

To delete it when you're done, add a "Call Method Track" to your AnimationPlayer and call a queue_free method on the last frame.

So you know, this can also be achieved with a shader but that's a little more advanced.

by (2,087 points)
selected by

Thank you for your reply. I did know about this method since I use this for Ki Blast spawning. But I thought maybe one of the UI nodes has a better way.
Thanks again.

That's the way I'd do it. Otherwise, you could maybe do it with a particle (meh, more hassle than it's worth) or you could use a canvas layer I suppose (I don't know why you would). Anything else is just making life complicated for no reason imho. I don't know anything in the UI which handles this. Apart from the shader which gives advantages in certain situation, is generally performant but much more of a pain to implement.

Simple is always good. :)

Yea I have chosen this way. I just thought there would be a different maybe better way of handling mouse related things like custom curser and curser effects and click effects. But in this case it's better to do it the way you suggested.

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.