1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-25 09:34:24 +00:00
This commit is contained in:
Caterina Gazzotti 2024-04-15 22:57:04 +02:00
commit 20f10c901d
8 changed files with 138 additions and 41 deletions

View file

@ -11,7 +11,7 @@ func spawn():
entity.global_scale = global_scale entity.global_scale = global_scale
entity.global_position = global_position entity.global_position = global_position
entity.global_rotation = global_rotation entity.global_rotation = global_rotation
parent.add_child(entity) parent.add_child.call_deferred(entity) # Not sure why this is needed.
func _ready(): func _ready():
if parent == null: if parent == null:

View file

@ -43,6 +43,14 @@ tag = &"Sheep"
[node name="SkullSpawner" parent="." instance=ExtResource("4_d8lgm")] [node name="SkullSpawner" parent="." instance=ExtResource("4_d8lgm")]
scene = ExtResource("5_yrfoq") scene = ExtResource("5_yrfoq")
[node name="Spawner" parent="." instance=ExtResource("4_d8lgm")]
scene = ExtResource("5_yrfoq")
[node name="Timer" type="Timer" parent="Spawner"]
wait_time = 0.8
autostart = true
[connection signal="move" from="Draggable" to="." method="_on_draggable_move"] [connection signal="move" from="Draggable" to="." method="_on_draggable_move"]
[connection signal="eaten" from="EatTarget" to="." method="_on_eat_target_eaten"] [connection signal="eaten" from="EatTarget" to="." method="_on_eat_target_eaten"]
[connection signal="move" from="EatTarget" to="." method="_on_move"] [connection signal="move" from="EatTarget" to="." method="_on_move"]
[connection signal="timeout" from="Spawner/Timer" to="Spawner" method="spawn"]

View file

@ -6,8 +6,12 @@ class_name Sheep
@onready var sprite: SpriteLeftRight = $"Sprite" @onready var sprite: SpriteLeftRight = $"Sprite"
@onready var drag_sound: AudioStreamPlayer2D = $"Draggable/DragSound" @onready var drag_sound: AudioStreamPlayer2D = $"Draggable/DragSound"
@onready var drop_sound: AudioStreamPlayer2D = $"Draggable/DropSound" @onready var drop_sound: AudioStreamPlayer2D = $"Draggable/DropSound"
@onready var animator: AnimationPlayer = $"Animator"
func _ready() -> void:
animator.play("RESET")
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)
@ -20,6 +24,8 @@ func _on_drag_move(movement: Vector2) -> void:
func _on_draggable_dragged() -> void: func _on_draggable_dragged() -> void:
drag_sound.play() drag_sound.play()
animator.play("wobble")
func _on_draggable_dropped() -> void: func _on_draggable_dropped() -> void:
drop_sound.play() drop_sound.play()
animator.play("RESET")

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://bc2bm8lbol18w"] [gd_scene load_steps=15 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="Texture2D" uid="uid://iljp5yn3ehfk" path="res://entities/sheep_left.png" id="2_t13f5"] [ext_resource type="Texture2D" uid="uid://iljp5yn3ehfk" path="res://entities/sheep_left.png" id="2_t13f5"]
@ -13,12 +13,71 @@
[sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"] [sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"]
radius = 8.0 radius = 8.0
[sub_resource type="Animation" id="Animation_lxieb"]
resource_name = "wobble"
length = 3.0
loop_mode = 1
step = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:rotation")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5, 1.5, 2, 3),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [0.0, -0.261799, 0.0, 0.261799, 0.0]
}
[sub_resource type="Animation" id="Animation_gokbg"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_s7ekl"]
resource_name = "shake"
length = 0.5
loop_mode = 1
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, 0), Vector2(1, 1), Vector2(-1, -1), Vector2(-1, 0), Vector2(1, -1), Vector2(-1, 1), Vector2(1, 1), Vector2(1, 0), Vector2(-1, -1), Vector2(1, 0), Vector2(0, -1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_6mutq"]
_data = {
"RESET": SubResource("Animation_gokbg"),
"shake": SubResource("Animation_s7ekl"),
"wobble": SubResource("Animation_lxieb")
}
[node name="Sheep" type="CharacterBody2D"] [node name="Sheep" type="CharacterBody2D"]
collision_layer = 8 collision_layer = 8
collision_mask = 14 collision_mask = 14
script = ExtResource("1_4dmll") script = ExtResource("1_4dmll")
[node name="Sprite" parent="." instance=ExtResource("2_xbkrm")] [node name="Sprite" parent="." instance=ExtResource("2_xbkrm")]
position = Vector2(1, 1)
scale = Vector2(2, 2) scale = Vector2(2, 2)
texture = ExtResource("2_t13f5") texture = ExtResource("2_t13f5")
left_texture = ExtResource("2_t13f5") left_texture = ExtResource("2_t13f5")
@ -47,6 +106,11 @@ stream = ExtResource("4_nxjnl")
[node name="Edible" parent="." instance=ExtResource("6_3odsh")] [node name="Edible" parent="." instance=ExtResource("6_3odsh")]
tag = &"Sheep" tag = &"Sheep"
[node name="Animator" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_6mutq")
}
[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="dragged" from="Draggable" to="." method="_on_draggable_dragged"]
[connection signal="dropped" from="Draggable" to="." method="_on_draggable_dropped"] [connection signal="dropped" from="Draggable" to="." method="_on_draggable_dropped"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://cxj5aud02f40j"] [gd_scene load_steps=14 format=3 uid="uid://cxj5aud02f40j"]
[ext_resource type="Script" path="res://scenes/game/main_game.gd" id="1_wiglu"] [ext_resource type="Script" path="res://scenes/game/main_game.gd" id="1_wiglu"]
[ext_resource type="PackedScene" path="res://behaviours/spawner.tscn" id="2_bx37o"] [ext_resource type="PackedScene" path="res://behaviours/spawner.tscn" id="2_bx37o"]
@ -7,8 +7,6 @@
[ext_resource type="PackedScene" uid="uid://brvbtvt4em32" path="res://behaviours/counter.tscn" id="3_p6jw3"] [ext_resource type="PackedScene" uid="uid://brvbtvt4em32" path="res://behaviours/counter.tscn" id="3_p6jw3"]
[ext_resource type="PackedScene" uid="uid://eqb3vfbvjefp" path="res://entities/cloud.tscn" id="3_whlmm"] [ext_resource type="PackedScene" uid="uid://eqb3vfbvjefp" path="res://entities/cloud.tscn" id="3_whlmm"]
[ext_resource type="PackedScene" uid="uid://7j1b55t8tafg" path="res://scenes/game/cursor_magnet.tscn" id="3_xbolm"] [ext_resource type="PackedScene" uid="uid://7j1b55t8tafg" path="res://scenes/game/cursor_magnet.tscn" id="3_xbolm"]
[ext_resource type="PackedScene" uid="uid://uoxwjpmgg27a" path="res://entities/gold.tscn" id="4_eu7q4"]
[ext_resource type="PackedScene" uid="uid://bc2bm8lbol18w" path="res://entities/sheep.tscn" id="5_63bwb"]
[ext_resource type="Texture2D" uid="uid://dyvkvmw7wxwe5" path="res://icon.svg" id="9_8kxq4"] [ext_resource type="Texture2D" uid="uid://dyvkvmw7wxwe5" path="res://icon.svg" id="9_8kxq4"]
[ext_resource type="PackedScene" uid="uid://4d3ksr3171x4" path="res://entities/imp.tscn" id="10_26rf6"] [ext_resource type="PackedScene" uid="uid://4d3ksr3171x4" path="res://entities/imp.tscn" id="10_26rf6"]
@ -846,44 +844,8 @@ debug_color = Color(1, 1, 1, 0)
[node name="GoldCounter" parent="." instance=ExtResource("3_p6jw3")] [node name="GoldCounter" parent="." instance=ExtResource("3_p6jw3")]
[node name="Gold" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(94, 70)
[node name="Gold2" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(239, 96)
[node name="Gold3" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(171, 199)
[node name="Gold4" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(352, 196)
[node name="Gold5" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(377, 96)
[node name="Gold6" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(434, 188)
[node name="Gold7" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(502, 104)
[node name="Gold8" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(249, -51)
[node name="Gold9" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(379, -58)
[node name="Gold10" parent="." instance=ExtResource("4_eu7q4")]
position = Vector2(456, -7)
[node name="Sheep" parent="." instance=ExtResource("5_63bwb")]
position = Vector2(-273, -86)
[node name="SpawnedEntities" type="Node2D" parent="."] [node name="SpawnedEntities" type="Node2D" parent="."]
[node name="Cloud" parent="." instance=ExtResource("3_whlmm")]
position = Vector2(-62, -239)
[node name="Node2D" type="Node2D" parent="."] [node name="Node2D" type="Node2D" parent="."]
position = Vector2(590, 317) position = Vector2(590, 317)
scale = Vector2(11.285, 11.285) scale = Vector2(11.285, 11.285)

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://pfr5ilmpa2me"
path="res://.godot/imported/layer1song.mp3-ce6bc20da8db13507fd0fd3e8c653f57.mp3str"
[deps]
source_file="res://temp/layer1song.mp3"
dest_files=["res://.godot/imported/layer1song.mp3-ce6bc20da8db13507fd0fd3e8c653f57.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c3h5p4m001fve"
path="res://.godot/imported/layer2song.mp3-bddbe3acc20e065899d402af3799ca36.mp3str"
[deps]
source_file="res://temp/layer2song.mp3"
dest_files=["res://.godot/imported/layer2song.mp3-bddbe3acc20e065899d402af3799ca36.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cp85uoga2ga5v"
path="res://.godot/imported/layer3song.mp3-5c48dfba6496ab0d326a87278a421d8b.mp3str"
[deps]
source_file="res://temp/layer3song.mp3"
dest_files=["res://.godot/imported/layer3song.mp3-5c48dfba6496ab0d326a87278a421d8b.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4