1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-25 01:24:23 +00:00

Add drag and drop sounds to Sheep

This commit is contained in:
Steffo 2024-04-14 22:03:59 +02:00
parent a1189f053a
commit 8218cfeab8
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
7 changed files with 29 additions and 10 deletions

View file

@ -6,11 +6,11 @@ This project uses the following external assets:
|------|-------|-----|
| `./icon.svg` | Godot icon | MIT license |
| `./temp/tollbell.mp3`| sdroliasnick freesound.org| CC0 |
| `./temp/sheep.wav`| michaelperfect freesound.org | CC0 |
| `./entities/sheep_drag.wav`| michaelperfect freesound.org | CC0 |
| `./temp/click&pop.wav`| GammaGoot freesound.org | CC0 |
| `./temp/pop.wav`| NovaSoundTechnology freesound.org | CC0 |
| `./temp/mouth_pop.wav`| igaopuromalte freesound.org | Attribution 4 |
| `./temp/puff.wav`| JustInvoke freesound.org | Attribution 4 |
| `./temp/place.wav`| Planman freesound.org | CC0 |
| `./entities/drop.wav`| Planman freesound.org | CC0 |
| `./temp/gore.wav`| MinecraftGamerLR freesound.org | Attribution 4 |
| `./temp/bones.wav`| cliftonmcarlson freesound.org | CC0 |

View file

@ -3,12 +3,12 @@
importer="wav"
type="AudioStreamWAV"
uid="uid://buxgivpkh8dyl"
path="res://.godot/imported/place.wav-6f3a5aef81053f3b0b94fbbb722a0c32.sample"
path="res://.godot/imported/drop.wav-e321e3ff0b5883beef3e60642ca137ca.sample"
[deps]
source_file="res://temp/place.wav"
dest_files=["res://.godot/imported/place.wav-6f3a5aef81053f3b0b94fbbb722a0c32.sample"]
source_file="res://entities/drop.wav"
dest_files=["res://.godot/imported/drop.wav-e321e3ff0b5883beef3e60642ca137ca.sample"]
[params]

View file

@ -3,13 +3,20 @@ class_name Sheep
@onready var draggable: Draggable = $"Draggable"
@onready var drag_sound: AudioStreamPlayer2D = $"Draggable/DragSound"
@onready var drop_sound: AudioStreamPlayer2D = $"Draggable/DropSound"
func _on_move(movement: Vector2) -> void:
if not draggable.being_dragged:
move_and_collide(movement)
func _on_drag_move(movement: Vector2) -> void:
if draggable.being_dragged:
move_and_collide(movement)
func _on_draggable_dragged() -> void:
drag_sound.play()
func _on_draggable_dropped() -> void:
drop_sound.play()

View file

@ -1,8 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://bc2bm8lbol18w"]
[gd_scene load_steps=8 format=3 uid="uid://bc2bm8lbol18w"]
[ext_resource type="Script" path="res://entities/sheep.gd" id="1_4dmll"]
[ext_resource type="PackedScene" uid="uid://bvrxvrjlo5130" path="res://behaviours/move_towards_mouse.tscn" id="2_tfd2i"]
[ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="3_8ku7r"]
[ext_resource type="AudioStream" uid="uid://buxgivpkh8dyl" path="res://entities/drop.wav" id="4_nxjnl"]
[ext_resource type="AudioStream" uid="uid://bmfscpnugaejk" path="res://entities/sheep_drag.wav" id="4_oalqu"]
[sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"]
radius = 16.0
@ -29,5 +31,15 @@ can_detach = true
[node name="Draggable" parent="." instance=ExtResource("3_8ku7r")]
scale = Vector2(2, 2)
[node name="DragSound" type="AudioStreamPlayer2D" parent="Draggable"]
scale = Vector2(0.5, 0.5)
stream = ExtResource("4_oalqu")
[node name="DropSound" type="AudioStreamPlayer2D" parent="Draggable"]
scale = Vector2(0.5, 0.5)
stream = ExtResource("4_nxjnl")
[connection signal="move" from="MoveTowardsMouse" to="." method="_on_move"]
[connection signal="dragged" from="Draggable" to="." method="_on_draggable_dragged"]
[connection signal="dropped" from="Draggable" to="." method="_on_draggable_dropped"]
[connection signal="move" from="Draggable" to="." method="_on_drag_move"]

View file

@ -3,12 +3,12 @@
importer="wav"
type="AudioStreamWAV"
uid="uid://bmfscpnugaejk"
path="res://.godot/imported/sheep.wav-5e192fa241f3aae906a657036a0b94de.sample"
path="res://.godot/imported/sheep_drag.wav-43fcf0f822dd8bb239b2bd20f832762a.sample"
[deps]
source_file="res://temp/sheep.wav"
dest_files=["res://.godot/imported/sheep.wav-5e192fa241f3aae906a657036a0b94de.sample"]
source_file="res://entities/sheep_drag.wav"
dest_files=["res://.godot/imported/sheep_drag.wav-43fcf0f822dd8bb239b2bd20f832762a.sample"]
[params]