Added water splash
This commit is contained in:
@@ -14,6 +14,7 @@ var target_x := 0.0
|
||||
|
||||
|
||||
@onready var sprite : Sprite2D = $CultistSprite
|
||||
@onready var water_splash : GPUParticles2D = $WaterSplash
|
||||
@onready var animated_sprite : AnimatedSprite2D = $SubViewport/CultistSprite
|
||||
|
||||
@onready var left_wall_high_ray : RayCast2D = $WallCheckHigh/LeftWallRay
|
||||
@@ -48,6 +49,16 @@ func _physics_process(delta: float) -> void:
|
||||
move_and_slide()
|
||||
|
||||
|
||||
func kill(type := KillingArea.Type.None) -> void:
|
||||
match type:
|
||||
KillingArea.Type.Water:
|
||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_splash, global_position)
|
||||
water_splash.finished.connect(queue_free)
|
||||
water_splash.restart()
|
||||
_:
|
||||
queue_free()
|
||||
|
||||
|
||||
func update_x_velocity(direction: int, max_speed: float, delta: float) -> void:
|
||||
velocity.x = move_toward(velocity.x, direction * max_speed, ACCELERATION * delta)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://but5aeh7y1s0f" path="res://game/characters/enemies/abstract_cultist.gd" id="1_2wrno"]
|
||||
[ext_resource type="PackedScene" uid="uid://dtxiercm8dsfm" path="res://game/characters/enemies/cultist_sprite.tscn" id="2_tjvyk"]
|
||||
[ext_resource type="PackedScene" uid="uid://8yd8f5x1hujv" path="res://game/characters/water_splash.tscn" id="2_w1t0g"]
|
||||
[ext_resource type="PackedScene" uid="uid://dike8xgbqdut2" path="res://game/killing_area.tscn" id="3_tjvyk"]
|
||||
[ext_resource type="PackedScene" uid="uid://bg7k6ovbk1xgm" path="res://game/characters/enemies/state_machine/cultist_state_machine.tscn" id="4_yu28k"]
|
||||
[ext_resource type="PackedScene" uid="uid://bq1v55jv4c6qe" path="res://game/characters/enemies/state_machine/cultist_state.tscn" id="5_tu2pi"]
|
||||
@@ -31,6 +32,9 @@ height = 28.0
|
||||
collision_layer = 0
|
||||
script = ExtResource("1_2wrno")
|
||||
|
||||
[node name="WaterSplash" parent="." unique_id=658940825 instance=ExtResource("2_w1t0g")]
|
||||
position = Vector2(0, -14)
|
||||
|
||||
[node name="CultistSprite" type="Sprite2D" parent="." unique_id=797412888]
|
||||
texture = SubResource("ViewportTexture_cqp7f")
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ var _is_switching_needed := false
|
||||
|
||||
|
||||
@onready var camera : Camera2D = $Camera2D
|
||||
@onready var water_splash : GPUParticles2D = $WaterSplash
|
||||
@onready var sprite : AnimatedSprite2D = $PlayerSprite
|
||||
@onready var particles : GPUParticles2D = $GPUParticles2D
|
||||
@onready var collision_switcher : CollisionSwitcher = $CollisionSwitcher
|
||||
@@ -102,7 +103,11 @@ func _switch() -> void:
|
||||
_is_switching_needed = true
|
||||
|
||||
|
||||
func kill() -> void:
|
||||
func kill(type := KillingArea.Type.None) -> void:
|
||||
match type:
|
||||
KillingArea.Type.Water:
|
||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_splash, global_position)
|
||||
water_splash.restart()
|
||||
is_dead = true
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://dtcad8tdx78tg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bb8kc32sggrn2" path="res://game/characters/player/player.gd" id="1_xln5q"]
|
||||
[ext_resource type="PackedScene" uid="uid://8yd8f5x1hujv" path="res://game/characters/water_splash.tscn" id="2_eeksw"]
|
||||
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="2_j06tb"]
|
||||
[ext_resource type="PackedScene" uid="uid://cvx6akiplg21s" path="res://game/characters/player/player_sprite.tscn" id="2_n6ad3"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdk23k2bypj8w" path="res://game/characters/player/state_machine/player_state_machine.tscn" id="4_ybe51"]
|
||||
@@ -39,6 +40,9 @@ collision_layer = 128
|
||||
collision_mask = 33
|
||||
script = ExtResource("1_xln5q")
|
||||
|
||||
[node name="WaterSplash" parent="." unique_id=658940825 instance=ExtResource("2_eeksw")]
|
||||
position = Vector2(0, -16)
|
||||
|
||||
[node name="PlayerSprite" parent="." unique_id=237719081 instance=ExtResource("2_n6ad3")]
|
||||
animation = &"jump_right"
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
[gd_scene format=3 uid="uid://8yd8f5x1hujv"]
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_kh0h8"]
|
||||
particle_flag_disable_z = true
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 4.0
|
||||
direction = Vector3(0, -1, 0)
|
||||
spread = 10.0
|
||||
initial_velocity_min = 50.0
|
||||
initial_velocity_max = 75.0
|
||||
gravity = Vector3(0, 98, 0)
|
||||
|
||||
[node name="WaterSplash" type="GPUParticles2D" unique_id=658940825]
|
||||
emitting = false
|
||||
amount = 32
|
||||
lifetime = 1.3
|
||||
one_shot = true
|
||||
explosiveness = 0.9
|
||||
fixed_fps = 10
|
||||
process_material = SubResource("ParticleProcessMaterial_kh0h8")
|
||||
+10
-1
@@ -2,10 +2,19 @@ class_name KillingArea
|
||||
extends Area2D
|
||||
|
||||
|
||||
enum Type {
|
||||
None,
|
||||
Water,
|
||||
}
|
||||
|
||||
|
||||
@export var type := Type.None
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if not body is CharacterBody2D: return
|
||||
|
||||
if body.has_method("kill"):
|
||||
body.kill()
|
||||
body.kill(type)
|
||||
else:
|
||||
body.queue_free()
|
||||
|
||||
@@ -227,15 +227,17 @@ tile_set = SubResource("TileSet_crrvt")
|
||||
|
||||
[node name="KillingArea1" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="0" unique_id=1891922549 instance=ExtResource("24_ia26y")]
|
||||
position = Vector2(1600, 380)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea1" index="0" unique_id=274691203]
|
||||
shape = SubResource("RectangleShape2D_o0jti")
|
||||
|
||||
[node name="KillingArea2" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="1" unique_id=1019647136 instance=ExtResource("24_ia26y")]
|
||||
position = Vector2(1976, 410)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea2" index="0" unique_id=335586472]
|
||||
shape = SubResource("RectangleShape2D_2gpk1")
|
||||
|
||||
[node name="LevelEnd" parent="." index="12" unique_id=1018767708]
|
||||
[node name="LevelEnd" parent="." index="13" unique_id=1018767708]
|
||||
position = Vector2(2416, 471)
|
||||
|
||||
@@ -159,9 +159,10 @@ tile_map_data = PackedByteArray("AAA8AB8AAAAAAAAAAAA9AB8AAAAAAAAAAAA+AB8AAAAAAAA
|
||||
|
||||
[node name="KillingArea" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="0" unique_id=1891922549 instance=ExtResource("19_7s8yo")]
|
||||
position = Vector2(1072, 540)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea" index="0" unique_id=1478981105]
|
||||
shape = SubResource("RectangleShape2D_v8xjl")
|
||||
|
||||
[node name="LevelEnd" parent="." index="8" unique_id=1018767708]
|
||||
[node name="LevelEnd" parent="." index="10" unique_id=1018767708]
|
||||
position = Vector2(1424, 602)
|
||||
|
||||
@@ -190,27 +190,31 @@ tile_map_data = PackedByteArray("AAAEACEAAAAAAAAAAAAEACIAAAAAAAEAAAAEACMAAAAAAAE
|
||||
|
||||
[node name="KillingArea1" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="0" unique_id=1891922549 instance=ExtResource("22_kqu3l")]
|
||||
position = Vector2(104, 572)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea1" index="0" unique_id=1658778408]
|
||||
shape = SubResource("RectangleShape2D_b1jnq")
|
||||
|
||||
[node name="KillingArea2" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="1" unique_id=772044084 instance=ExtResource("22_kqu3l")]
|
||||
position = Vector2(424, 524)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea2" index="0" unique_id=1357291357]
|
||||
shape = SubResource("RectangleShape2D_kqu3l")
|
||||
|
||||
[node name="KillingArea3" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="2" unique_id=741954334 instance=ExtResource("22_kqu3l")]
|
||||
position = Vector2(912, 860)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea3" index="0" unique_id=718491883]
|
||||
shape = SubResource("RectangleShape2D_54p7s")
|
||||
|
||||
[node name="KillingArea4" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="3" unique_id=482672287 instance=ExtResource("22_kqu3l")]
|
||||
position = Vector2(448, 1148)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea4" index="0" unique_id=319407131]
|
||||
shape = SubResource("RectangleShape2D_80tx3")
|
||||
|
||||
[node name="LevelEnd" parent="." index="8" unique_id=1018767708]
|
||||
[node name="LevelEnd" parent="." index="10" unique_id=1018767708]
|
||||
position = Vector2(1024, 1218)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -168,7 +168,7 @@ position = Vector2(-38, -12)
|
||||
[node name="CircleKeyPickup" parent="Pickups" parent_id_path=PackedInt32Array(1113969064) index="0" unique_id=571829333 instance=ExtResource("6_r6jdw")]
|
||||
position = Vector2(-974, 632)
|
||||
|
||||
[node name="Player" parent="." index="4" unique_id=1058744997]
|
||||
[node name="Player" parent="." index="6" unique_id=1058744997]
|
||||
position = Vector2(0, 109)
|
||||
|
||||
[node name="GrayWalls" parent="Tiles" parent_id_path=PackedInt32Array(1626037498) index="0" unique_id=557672309]
|
||||
@@ -185,21 +185,24 @@ tile_map_data = PackedByteArray("AADM/yoAAAAAAAAAAADM/ysAAAAAAAEAAADM/ywAAAAAAAE
|
||||
|
||||
[node name="KillingArea1" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="0" unique_id=1891922549 instance=ExtResource("17_8fy2b")]
|
||||
position = Vector2(-512, 716)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea1" index="0" unique_id=490664864]
|
||||
shape = SubResource("RectangleShape2D_j8u63")
|
||||
|
||||
[node name="KillingArea2" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="1" unique_id=1087634228 instance=ExtResource("17_8fy2b")]
|
||||
position = Vector2(-672, 716)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea2" index="0" unique_id=55967834]
|
||||
shape = SubResource("RectangleShape2D_wjoyx")
|
||||
|
||||
[node name="KillingArea3" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="2" unique_id=160083081 instance=ExtResource("17_8fy2b")]
|
||||
position = Vector2(-800, 716)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea3" index="0" unique_id=2058383047]
|
||||
shape = SubResource("RectangleShape2D_5nurb")
|
||||
|
||||
[node name="LevelEnd" parent="." index="8" unique_id=1018767708]
|
||||
[node name="LevelEnd" parent="." index="10" unique_id=1018767708]
|
||||
position = Vector2(256, 797)
|
||||
|
||||
@@ -327,7 +327,7 @@ position = Vector2(587, 368)
|
||||
[node name="WhiteCultist2" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="3" unique_id=624398972 instance=ExtResource("23_8555i")]
|
||||
position = Vector2(549, 160)
|
||||
|
||||
[node name="Player" parent="." index="4" unique_id=1058744997]
|
||||
[node name="Player" parent="." index="6" unique_id=1058744997]
|
||||
position = Vector2(208, -162)
|
||||
|
||||
[node name="GrayWalls" parent="Tiles" parent_id_path=PackedInt32Array(1626037498) index="0" unique_id=557672309]
|
||||
@@ -344,15 +344,17 @@ tile_map_data = PackedByteArray("AAAgABgAAAAAAAAAAAAgABkAAAAAAAEAAAAgABoAAAAAAAE
|
||||
|
||||
[node name="KillingArea1" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="0" unique_id=1891922549 instance=ExtResource("24_te27h")]
|
||||
position = Vector2(584, 428)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea1" index="0" unique_id=90224205]
|
||||
shape = SubResource("RectangleShape2D_cjy8w")
|
||||
|
||||
[node name="KillingArea2" parent="KillingAreas" parent_id_path=PackedInt32Array(1935554921) index="1" unique_id=1371007521 instance=ExtResource("24_te27h")]
|
||||
position = Vector2(992, 428)
|
||||
type = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingAreas/KillingArea2" index="0" unique_id=213687068]
|
||||
shape = SubResource("RectangleShape2D_own00")
|
||||
|
||||
[node name="LevelEnd" parent="." index="8" unique_id=1018767708]
|
||||
[node name="LevelEnd" parent="." index="10" unique_id=1018767708]
|
||||
position = Vector2(400, 890)
|
||||
|
||||
@@ -37,6 +37,7 @@ const MUSIC_BUS = "Music"
|
||||
@export var sfx_stream_lever : AudioStream
|
||||
@export var sfx_stream_player_lost : AudioStream
|
||||
@export var sfx_stream_player_spoted : AudioStream
|
||||
@export var sfx_stream_splash : AudioStream
|
||||
@export var sfx_stream_switch : AudioStream
|
||||
|
||||
@export_group("Music Streams", "music_stream")
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://buv55jfj7qhix" path="res://sound/sfx/lever.wav" id="15_3d1ws"]
|
||||
[ext_resource type="AudioStream" uid="uid://ckmpft46wjgqs" path="res://sound/music/main_menu.wav" id="17_g6nb7"]
|
||||
[ext_resource type="AudioStream" uid="uid://ttemdy7avyh7" path="res://sound/music/gameplay.wav" id="17_l5yxe"]
|
||||
[ext_resource type="AudioStream" uid="uid://ckykxq8ugds41" path="res://sound/sfx/splash.wav" id="18_4cvue"]
|
||||
|
||||
[node name="SoundManager" type="Node" unique_id=1917953940]
|
||||
process_mode = 3
|
||||
@@ -46,6 +47,7 @@ sfx_stream_level_completed = ExtResource("7_22ptj")
|
||||
sfx_stream_lever = ExtResource("15_3d1ws")
|
||||
sfx_stream_player_lost = ExtResource("8_6ll5c")
|
||||
sfx_stream_player_spoted = ExtResource("9_q7cyi")
|
||||
sfx_stream_splash = ExtResource("18_4cvue")
|
||||
sfx_stream_switch = ExtResource("7_ab171")
|
||||
music_stream_gameplay = ExtResource("17_l5yxe")
|
||||
music_stream_main_menu = ExtResource("17_g6nb7")
|
||||
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://ckykxq8ugds41"
|
||||
path="res://.godot/imported/splash.wav-64b8b51083c110101798a6492c826392.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sound/sfx/splash.wav"
|
||||
dest_files=["res://.godot/imported/splash.wav-64b8b51083c110101798a6492c826392.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
Reference in New Issue
Block a user