mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 23:54:23 +00:00
Update Sheep
with sprites
This commit is contained in:
parent
2b513b8bb2
commit
bdde57200f
6 changed files with 24 additions and 17 deletions
|
@ -3,6 +3,7 @@ class_name Sheep
|
||||||
|
|
||||||
|
|
||||||
@onready var draggable: Draggable = $"Draggable"
|
@onready var draggable: Draggable = $"Draggable"
|
||||||
|
@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"
|
||||||
|
|
||||||
|
@ -10,10 +11,12 @@ class_name Sheep
|
||||||
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)
|
||||||
|
sprite.handle_move(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)
|
||||||
|
sprite.handle_move(movement)
|
||||||
|
|
||||||
func _on_draggable_dragged() -> void:
|
func _on_draggable_dragged() -> void:
|
||||||
drag_sound.play()
|
drag_sound.play()
|
||||||
|
|
|
@ -1,36 +1,40 @@
|
||||||
[gd_scene load_steps=9 format=3 uid="uid://bc2bm8lbol18w"]
|
[gd_scene load_steps=11 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="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://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="2_xbkrm"]
|
||||||
[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="Texture2D" uid="uid://cxtmas4g0v6en" path="res://entities/sheep_right.png" id="4_5qoof"]
|
||||||
[ext_resource type="AudioStream" uid="uid://buxgivpkh8dyl" path="res://entities/drop.wav" id="4_nxjnl"]
|
[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"]
|
[ext_resource type="AudioStream" uid="uid://bmfscpnugaejk" path="res://entities/sheep_drag.wav" id="4_oalqu"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="6_3odsh"]
|
[ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="6_3odsh"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"]
|
||||||
radius = 16.0
|
radius = 8.0
|
||||||
|
|
||||||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_08frh"]
|
|
||||||
|
|
||||||
[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="Shape" type="CollisionShape2D" parent="."]
|
[node name="Sprite" parent="." instance=ExtResource("2_xbkrm")]
|
||||||
shape = SubResource("CircleShape2D_c5tcn")
|
scale = Vector2(2, 2)
|
||||||
|
texture = ExtResource("2_t13f5")
|
||||||
|
left_texture = ExtResource("2_t13f5")
|
||||||
|
right_texture = ExtResource("4_5qoof")
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite2D" parent="."]
|
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||||
scale = Vector2(32, 32)
|
scale = Vector2(3, 3)
|
||||||
texture = SubResource("PlaceholderTexture2D_08frh")
|
shape = SubResource("CircleShape2D_c5tcn")
|
||||||
|
|
||||||
[node name="MoveTowardsMouse" parent="." instance=ExtResource("2_tfd2i")]
|
[node name="MoveTowardsMouse" parent="." instance=ExtResource("2_tfd2i")]
|
||||||
scale = Vector2(30, 30)
|
scale = Vector2(30, 30)
|
||||||
speed = -20.0
|
speed = -30.0
|
||||||
can_detach = true
|
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(3, 3)
|
||||||
|
|
||||||
[node name="DragSound" type="AudioStreamPlayer2D" parent="Draggable"]
|
[node name="DragSound" type="AudioStreamPlayer2D" parent="Draggable"]
|
||||||
scale = Vector2(0.5, 0.5)
|
scale = Vector2(0.5, 0.5)
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://iljp5yn3ehfk"
|
uid="uid://iljp5yn3ehfk"
|
||||||
path="res://.godot/imported/monster_sheep_onground_left.png-08d1e529839158a8ce15c655b8686183.ctex"
|
path="res://.godot/imported/sheep_left.png-6cb7b8ff0f6e711799b2ba3837486862.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://temp/monster_sheep_onground_left.png"
|
source_file="res://entities/sheep_left.png"
|
||||||
dest_files=["res://.godot/imported/monster_sheep_onground_left.png-08d1e529839158a8ce15c655b8686183.ctex"]
|
dest_files=["res://.godot/imported/sheep_left.png-6cb7b8ff0f6e711799b2ba3837486862.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://cxtmas4g0v6en"
|
uid="uid://cxtmas4g0v6en"
|
||||||
path="res://.godot/imported/monster_sheep_onground_right.png-010a81d06e110e85b38610fa3b9ae5de.ctex"
|
path="res://.godot/imported/sheep_right.png-3f6753401041e87494add5c84980155c.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://temp/monster_sheep_onground_right.png"
|
source_file="res://entities/sheep_right.png"
|
||||||
dest_files=["res://.godot/imported/monster_sheep_onground_right.png-010a81d06e110e85b38610fa3b9ae5de.ctex"]
|
dest_files=["res://.godot/imported/sheep_right.png-3f6753401041e87494add5c84980155c.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
Loading…
Reference in a new issue