1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-22 08:04:23 +00:00
This commit is contained in:
Caterina Gazzotti 2024-04-14 21:18:09 +02:00
commit 3fc74cf0d9
11 changed files with 51 additions and 1 deletions

View file

@ -9,6 +9,8 @@ radius = 16.0
script = ExtResource("1_p0pc3")
[node name="MouseArea" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 0
monitorable = false
[node name="Shape" type="CollisionShape2D" parent="MouseArea"]

View file

@ -7,6 +7,8 @@
radius = 8.0
[node name="Draggable" type="Area2D"]
collision_layer = 0
collision_mask = 0
script = ExtResource("1_hdedq")
[node name="Shape" type="CollisionShape2D" parent="."]

View file

@ -6,6 +6,8 @@
radius = 8.0
[node name="HoverDetector" type="Area2D"]
collision_layer = 0
collision_mask = 0
monitorable = false
script = ExtResource("1_51m5p")

View file

@ -9,6 +9,9 @@ radius = 100.0
script = ExtResource("1_3bmd5")
[node name="DetectionArea" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 24
monitorable = false
[node name="Shape" type="CollisionShape2D" parent="DetectionArea"]
shape = SubResource("CircleShape2D_kxb8e")

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=3 format=3 uid="uid://c7b4v6h7a3dy6"]
[gd_scene load_steps=3 format=3 uid="uid://kceb2v2dm0qn"]
[ext_resource type="Script" path="res://behaviours/move_towards_target.gd" id="1_703gy"]
[ext_resource type="PackedScene" uid="uid://cbg5kgwxusvxf" path="res://behaviours/hover_detector.tscn" id="2_nq6qb"]
@ -7,6 +7,7 @@
script = ExtResource("1_703gy")
[node name="CaptureArea" parent="." instance=ExtResource("2_nq6qb")]
collision_mask = 24
[connection signal="mouse_entered" from="CaptureArea" to="." method="_on_capture_area_mouse_entered"]
[connection signal="mouse_exited" from="CaptureArea" to="." method="_on_capture_area_mouse_exited"]

18
behaviours/spawner.gd Normal file
View file

@ -0,0 +1,18 @@
extends Node2D
class_name Spawner
signal spawned(entity: Node2D)
@export var scene: PackedScene
@export var parent: Node2D
func spawn():
var entity = scene.instantiate()
entity.global_scale = global_scale
entity.global_position = global_position
entity.global_rotation = global_rotation
parent.add_child(entity)
func _ready():
if parent == null:
parent = MainGame.get_ancestor(self).get_node("SpawnedEntities")

6
behaviours/spawner.tscn Normal file
View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://cyrg770fsetyu"]
[ext_resource type="Script" path="res://behaviours/spawner.gd" id="1_b4uk0"]
[node name="Spawner" type="Node2D"]
script = ExtResource("1_b4uk0")

View file

@ -10,6 +10,8 @@ radius = 16.0
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_08frh"]
[node name="Sheep" type="CharacterBody2D"]
collision_layer = 8
collision_mask = 14
script = ExtResource("1_4dmll")
[node name="Shape" type="CollisionShape2D" parent="."]

View file

@ -33,6 +33,16 @@ main_menu={
]
}
[layer_names]
2d_physics/layer_1="Unset"
2d_physics/layer_2="Tiles"
2d_physics/layer_3="Trees"
2d_physics/layer_4="Entities (grounded)"
2d_physics/layer_5="Entities (air)"
2d_physics/layer_6="Pickups"
2d_physics/layer_7="System"
[physics]
common/physics_ticks_per_second=100

View file

@ -7,6 +7,8 @@
radius = 16.0
[node name="CursorMagnet" type="Area2D"]
collision_layer = 64
collision_mask = 8
script = ExtResource("1_xk040")
[node name="Shape" type="CollisionShape2D" parent="."]

View file

@ -66,3 +66,5 @@ position = Vector2(-135, -134)
[node name="Sheep2" parent="." instance=ExtResource("5_63bwb")]
position = Vector2(-462, -77)
[node name="SpawnedEntities" type="Node2D" parent="."]