Adds sand particles to the crabs minigame.

This commit is contained in:
Dylan Sarrazyn
2024-03-12 11:00:18 +01:00
committed by BimDav
parent 79f5e5f737
commit 643d7edab0
20 changed files with 320 additions and 8 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://05x78yqg7ymp"
path="res://.godot/imported/Sand_01.png-8ec7f8269c778ac6e43e37e9ac48f7b3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vfx/Sand_01.png"
dest_files=["res://.godot/imported/Sand_01.png-8ec7f8269c778ac6e43e37e9ac48f7b3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bki2x8c6lhwc8"
path="res://.godot/imported/Sand_02.png-993fde11d00a238f232a479dc304bd93.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vfx/Sand_02.png"
dest_files=["res://.godot/imported/Sand_02.png-993fde11d00a238f232a479dc304bd93.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bkugkqtg02wlw"
path="res://.godot/imported/Sand_03.png-9cb996fb623287df22a40608661fece5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vfx/Sand_03.png"
dest_files=["res://.godot/imported/Sand_03.png-9cb996fb623287df22a40608661fece5.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://j1kmm0olh8pf"
path="res://.godot/imported/Sand_04.png-d43edfc53f5cc65cd98fd0521f5fc1aa.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vfx/Sand_04.png"
dest_files=["res://.godot/imported/Sand_04.png-d43edfc53f5cc65cd98fd0521f5fc1aa.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://x0j8kn1s0vjo"
path="res://.godot/imported/Sand_05.png-35128b0434fbd6b883915c0d5d6da6c3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vfx/Sand_05.png"
dest_files=["res://.godot/imported/Sand_05.png-35128b0434fbd6b883915c0d5d6da6c3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bldybg1salt8v"
path="res://.godot/imported/Sand_06.png-618659537f3f6c0d827570eb42254e58.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vfx/Sand_06.png"
dest_files=["res://.godot/imported/Sand_06.png-618659537f3f6c0d827570eb42254e58.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bdf3ydwjg3ry4"
path="res://.godot/imported/Sand_07.png-c8e9cf35e99b5b5bb5b67db07f5f88c6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vfx/Sand_07.png"
dest_files=["res://.godot/imported/Sand_07.png-c8e9cf35e99b5b5bb5b67db07f5f88c6.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
+2 -2
View File
@@ -226,10 +226,10 @@ sprites = [NodePath("AnimatedSprite2D")]
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="SpriteControl"]
unique_name_in_owner = true
position = Vector2(103, 90)
scale = Vector2(1e-05, 1e-05)
sprite_frames = SubResource("SpriteFrames_g5q5i")
animation = &"idle2"
animation = &"idle1"
autoplay = "idle1"
frame_progress = 0.00802341
centered = false
offset = Vector2(-108, -90)
+5
View File
@@ -9,6 +9,7 @@ const crab_scene: = preload("res://sources/minigames/crabs/crab/crab.tscn")
@onready var hole_back: = $HoleBack
@onready var hole_front: = $HoleFront
@onready var mask: = $Mask
@onready var sand_vfx: SandVFX = $SandVFX
@onready var timer: = $Timer
@onready var crab_audio_stream_player: = $CrabAudioStreamPlayer2D
@@ -26,6 +27,7 @@ func spawn_crab(stimulus: Dictionary) -> void:
crab.stimulus = stimulus
# Show the crab but not the stimulus
sand_vfx.start()
crab_audio_stream_player.start_playing()
var tween: = create_tween()
tween.tween_property(crab, "position", Vector2(crab_x, 20), randf_range(0.25, 2.0))
@@ -36,6 +38,7 @@ func spawn_crab(stimulus: Dictionary) -> void:
await timer.timeout
# The crab gets completely out
sand_vfx.stop()
crab_audio_stream_player.start_playing()
tween = create_tween()
tween.tween_property(crab, "position", Vector2(crab_x, -130.0), 0.5)
@@ -49,12 +52,14 @@ func spawn_crab(stimulus: Dictionary) -> void:
return
# The crab disappears in the hole
sand_vfx.start()
crab_audio_stream_player.start_playing()
tween = create_tween()
tween.tween_property(crab, "position", Vector2(crab_x, 100.0), 0.5)
if await is_button_pressed_with_limit(tween.finished):
return
crab_audio_stream_player.stop_playing()
sand_vfx.stop()
crab.queue_free()
crab = null
+6 -1
View File
@@ -1,10 +1,11 @@
[gd_scene load_steps=7 format=3 uid="uid://bggrf54kye5vl"]
[gd_scene load_steps=8 format=3 uid="uid://bggrf54kye5vl"]
[ext_resource type="Script" path="res://sources/minigames/crabs/hole/hole.gd" id="1_05s8c"]
[ext_resource type="Texture2D" uid="uid://tfigqbebxmal" path="res://assets/minigames/crabs/graphic/hole_back.png" id="2_osih7"]
[ext_resource type="Texture2D" uid="uid://7nrlmc7opox1" path="res://assets/minigames/crabs/graphic/hole_mask.png" id="3_ietrg"]
[ext_resource type="Texture2D" uid="uid://jl4sirrpr1l1" path="res://icon.svg" id="4_5yovx"]
[ext_resource type="Texture2D" uid="uid://cwebei83ml5vs" path="res://assets/minigames/crabs/graphic/hole_front.png" id="5_ahgwg"]
[ext_resource type="PackedScene" uid="uid://dt8ynpufhqs5w" path="res://sources/utils/fx/sand.tscn" id="5_vress"]
[ext_resource type="Script" path="res://sources/minigames/crabs/hole/hole_audio_stream_player_2d.gd" id="6_2rg3s"]
[node name="Hole" type="Node2D"]
@@ -24,6 +25,10 @@ texture = ExtResource("3_ietrg")
position = Vector2(-1, 263)
texture = ExtResource("4_5yovx")
[node name="SandVFX" parent="." instance=ExtResource("5_vress")]
offset_top = 57.7778
offset_bottom = 57.7778
[node name="HoleFront" type="Sprite2D" parent="."]
position = Vector2(0, 2)
texture = ExtResource("5_ahgwg")
+4 -5
View File
@@ -6,14 +6,14 @@
[ext_resource type="PackedScene" uid="uid://cge0uyn30tcpv" path="res://sources/utils/fx/highlight.tscn" id="3_5uhvd"]
[ext_resource type="Script" path="res://sources/utils/percent_margin_container.gd" id="3_vllju"]
[ext_resource type="PackedScene" uid="uid://c6klih3h3ws6f" path="res://sources/utils/auto_size_label.tscn" id="4_26xiq"]
[ext_resource type="SpriteFrames" uid="uid://dquynn3nx52o" path="res://sources/minigames/jellyfish/red_jellyfish_animations.tres" id="5_ei020"]
[ext_resource type="SpriteFrames" uid="uid://dquynn3nx52o" path="res://sources/minigames/jellyfish/red_jellyfish_animations.tres" id="5_74hi7"]
[ext_resource type="PackedScene" uid="uid://dlmbxcgiv8tpr" path="res://sources/utils/fx/wrong.tscn" id="6_w1tlu"]
[node name="Jellyfish" type="MarginContainer"]
custom_minimum_size = Vector2(400, 400)
offset_right = 400.0
offset_bottom = 400.0
scale = Vector2(1.16534, 1.16534)
scale = Vector2(1.1298, 1.1298)
script = ExtResource("1_06uwq")
[node name="BackFX" type="Control" parent="."]
@@ -55,10 +55,9 @@ sprites = [NodePath("AnimatedSprite2D")]
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="SpriteControl"]
unique_name_in_owner = true
position = Vector2(200.8, 109.84)
scale = Vector2(2.15054, 2.15054)
sprite_frames = ExtResource("5_ei020")
scale = Vector2(1e-05, 1e-05)
sprite_frames = ExtResource("5_74hi7")
animation = &"idle"
frame_progress = 0.444917
centered = false
offset = Vector2(-93.3722, -51.0754)
+35
View File
@@ -0,0 +1,35 @@
@tool
extends Control
class_name SandVFX
const textures: Array[Resource] = [
preload("res://assets/vfx/Sand_01.png"),
preload("res://assets/vfx/Sand_02.png"),
preload("res://assets/vfx/Sand_03.png"),
preload("res://assets/vfx/Sand_04.png"),
preload("res://assets/vfx/Sand_05.png"),
preload("res://assets/vfx/Sand_06.png"),
preload("res://assets/vfx/Sand_07.png")
]
@onready var particles : GPUParticles2D = $Particles
@onready var timer : Timer = $Timer
func _ready():
timer.wait_time = particles.lifetime
func start():
_on_timer_timeout()
func stop():
timer.stop()
func _on_timer_timeout():
particles.texture = textures.pick_random()
particles.amount = randi_range(6, 18)
particles.restart()
timer.start()
+30
View File
@@ -0,0 +1,30 @@
[gd_scene load_steps=4 format=3 uid="uid://dt8ynpufhqs5w"]
[ext_resource type="Script" path="res://sources/utils/fx/sand.gd" id="1_rveeh"]
[ext_resource type="Texture2D" uid="uid://bdf3ydwjg3ry4" path="res://assets/vfx/Sand_07.png" id="3_v27vk"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_l5ec5"]
particle_flag_disable_z = true
direction = Vector3(0, -1, 0)
initial_velocity_min = 76.0
initial_velocity_max = 100.0
gravity = Vector3(0, 98, 0)
turbulence_noise_strength = 20.0
[node name="Sand" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_rveeh")
[node name="Particles" type="GPUParticles2D" parent="."]
emitting = false
amount = 10
process_material = SubResource("ParticleProcessMaterial_l5ec5")
texture = ExtResource("3_v27vk")
one_shot = true
explosiveness = 0.8
[node name="Timer" type="Timer" parent="."]
one_shot = true
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]