summaryrefslogtreecommitdiff
path: root/godot/scenes/environment/Water.gd
blob: 54bb237cfa4425fe4297d1a89968702fb5cc4132 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extends Spatial


func create_splash(pos, size):
	var splash = preload("res://particles/WaterSplash.tscn").instance()
	get_parent().add_child(splash)
	splash.global_transform.origin = pos
	splash.scale = size*Vector3.ONE

func _on_WaterArea_body_entered(body):
	if body.has_method("extinguish"): body.extinguish()
	if body.has_method("enter_water"): body.enter_water()
	#print(body.get_aabb().get_area())
	create_splash(body.global_transform.origin, 1.5)

func _on_WaterArea_body_exited(body):
	if body.has_method("exit_water"): body.exit_water()