Need help making a splash when you fall off the map

Godot Version



I have an rpg where you lose when you fall off the edge into water. I already have the detection, I just need ideas on how to add that splash when the player loses.

Untested, but it should work (maybe with some corrections…)

Create an animation scene of the water splash and preload it in a script (maybe the player one?) like this:

var watersplash = preload(“res://effects/watersplash.tscn”)

When the player touches the water, use player global position and instantiate the animation, like this:

var WaterSplahInstance = var_watersplash.instantiate()
WaterSplash.position = get_global_position()

The animation must have a script which destroys the instance at the end of animation:

func _on_animation_player_animation_finished(anim_name):

I modified the scripts I use for instancing my projectiles, I hope it works ok…

(question: do someone knows how can I mantain the Tabs etc. when I copy a script to show it?)

I think it should. Thank you. I have been scratching my head thinking of a simple way to do this.

no Idea how to keep the tabs. I have tried myself.

1 Like