diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2022-09-14 23:59:22 -0400 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2022-09-14 23:59:22 -0400 |
| commit | aad319ddb5be108e9ca81d407bd90c843bae502d (patch) | |
| tree | b67c7bf158a65830207e87cbff975375b2f6838b /godot/scenes/environment | |
| parent | b5e9597ae82b4de04f77426ebdad9e1e2af15782 (diff) | |
GUNBRIG HULL PROTOTYPE
Diffstat (limited to 'godot/scenes/environment')
| -rw-r--r-- | godot/scenes/environment/Water.gd | 13 | ||||
| -rw-r--r-- | godot/scenes/environment/Water.tscn | 6 |
2 files changed, 18 insertions, 1 deletions
diff --git a/godot/scenes/environment/Water.gd b/godot/scenes/environment/Water.gd new file mode 100644 index 0000000..6fd4dc2 --- /dev/null +++ b/godot/scenes/environment/Water.gd @@ -0,0 +1,13 @@ +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() + #print(body.get_aabb().get_area()) + create_splash(body.global_transform.origin, 1.5) diff --git a/godot/scenes/environment/Water.tscn b/godot/scenes/environment/Water.tscn index 04410b1..8b7718b 100644 --- a/godot/scenes/environment/Water.tscn +++ b/godot/scenes/environment/Water.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://textures/WaterC.jpg" type="Texture" id=1] [ext_resource path="res://textures/WaterA.jpg" type="Texture" id=2] +[ext_resource path="res://scenes/environment/Water.gd" type="Script" id=3] [sub_resource type="QuadMesh" id=1] size = Vector2( 2, 2 ) @@ -95,6 +96,7 @@ shader_param/BackgroundTexture = ExtResource( 1 ) [sub_resource type="BoxShape" id=4] [node name="Water" type="Spatial"] +script = ExtResource( 3 ) [node name="MeshInstance" type="MeshInstance" parent="."] transform = Transform( 1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0 ) @@ -107,3 +109,5 @@ collision_layer = 4 [node name="CollisionShape" type="CollisionShape" parent="WaterArea"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) shape = SubResource( 4 ) + +[connection signal="body_entered" from="WaterArea" to="." method="_on_WaterArea_body_entered"] |
