mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-22 08:04:23 +00:00
Add drag and drop sounds to Sheep
This commit is contained in:
parent
a1189f053a
commit
8218cfeab8
7 changed files with 29 additions and 10 deletions
|
@ -6,11 +6,11 @@ This project uses the following external assets:
|
||||||
|------|-------|-----|
|
|------|-------|-----|
|
||||||
| `./icon.svg` | Godot icon | MIT license |
|
| `./icon.svg` | Godot icon | MIT license |
|
||||||
| `./temp/tollbell.mp3`| sdroliasnick freesound.org| CC0 |
|
| `./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/click&pop.wav`| GammaGoot freesound.org | CC0 |
|
||||||
| `./temp/pop.wav`| NovaSoundTechnology freesound.org | CC0 |
|
| `./temp/pop.wav`| NovaSoundTechnology freesound.org | CC0 |
|
||||||
| `./temp/mouth_pop.wav`| igaopuromalte freesound.org | Attribution 4 |
|
| `./temp/mouth_pop.wav`| igaopuromalte freesound.org | Attribution 4 |
|
||||||
| `./temp/puff.wav`| JustInvoke 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/gore.wav`| MinecraftGamerLR freesound.org | Attribution 4 |
|
||||||
| `./temp/bones.wav`| cliftonmcarlson freesound.org | CC0 |
|
| `./temp/bones.wav`| cliftonmcarlson freesound.org | CC0 |
|
|
@ -3,12 +3,12 @@
|
||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://buxgivpkh8dyl"
|
uid="uid://buxgivpkh8dyl"
|
||||||
path="res://.godot/imported/place.wav-6f3a5aef81053f3b0b94fbbb722a0c32.sample"
|
path="res://.godot/imported/drop.wav-e321e3ff0b5883beef3e60642ca137ca.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://temp/place.wav"
|
source_file="res://entities/drop.wav"
|
||||||
dest_files=["res://.godot/imported/place.wav-6f3a5aef81053f3b0b94fbbb722a0c32.sample"]
|
dest_files=["res://.godot/imported/drop.wav-e321e3ff0b5883beef3e60642ca137ca.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
|
@ -3,13 +3,20 @@ class_name Sheep
|
||||||
|
|
||||||
|
|
||||||
@onready var draggable: Draggable = $"Draggable"
|
@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:
|
func _on_move(movement: Vector2) -> void:
|
||||||
if not draggable.being_dragged:
|
if not draggable.being_dragged:
|
||||||
move_and_collide(movement)
|
move_and_collide(movement)
|
||||||
|
|
||||||
|
|
||||||
func _on_drag_move(movement: Vector2) -> void:
|
func _on_drag_move(movement: Vector2) -> void:
|
||||||
if draggable.being_dragged:
|
if draggable.being_dragged:
|
||||||
move_and_collide(movement)
|
move_and_collide(movement)
|
||||||
|
|
||||||
|
func _on_draggable_dragged() -> void:
|
||||||
|
drag_sound.play()
|
||||||
|
|
||||||
|
func _on_draggable_dropped() -> void:
|
||||||
|
drop_sound.play()
|
||||||
|
|
|
@ -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="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://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="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"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"]
|
||||||
radius = 16.0
|
radius = 16.0
|
||||||
|
@ -29,5 +31,15 @@ can_detach = true
|
||||||
[node name="Draggable" parent="." instance=ExtResource("3_8ku7r")]
|
[node name="Draggable" parent="." instance=ExtResource("3_8ku7r")]
|
||||||
scale = Vector2(2, 2)
|
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="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"]
|
[connection signal="move" from="Draggable" to="." method="_on_drag_move"]
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
importer="wav"
|
importer="wav"
|
||||||
type="AudioStreamWAV"
|
type="AudioStreamWAV"
|
||||||
uid="uid://bmfscpnugaejk"
|
uid="uid://bmfscpnugaejk"
|
||||||
path="res://.godot/imported/sheep.wav-5e192fa241f3aae906a657036a0b94de.sample"
|
path="res://.godot/imported/sheep_drag.wav-43fcf0f822dd8bb239b2bd20f832762a.sample"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://temp/sheep.wav"
|
source_file="res://entities/sheep_drag.wav"
|
||||||
dest_files=["res://.godot/imported/sheep.wav-5e192fa241f3aae906a657036a0b94de.sample"]
|
dest_files=["res://.godot/imported/sheep_drag.wav-43fcf0f822dd8bb239b2bd20f832762a.sample"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
Loading…
Reference in a new issue