1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-21 15:44:23 +00:00

Remove spawning sheep via cursor

This commit is contained in:
Steffo 2024-05-01 05:03:11 +02:00
parent 31dc930ec1
commit 5b5f6317cd
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 1 additions and 33 deletions

View file

@ -8,9 +8,6 @@ signal dragged(node: Draggable)
signal dropped(node: Draggable)
@export var sheep_spawn_cost: int = 5
@onready var game: MainGame = MainGame.get_via_group(self)
@onready var gold_display: GoldDisplay = %"GoldDisplay"
@onready var sheep_spawner: Spawner = %"SheepSpawner"
@ -65,12 +62,6 @@ func _input(event: InputEvent) -> void:
drag()
else:
drop()
elif event.button_index == MOUSE_BUTTON_RIGHT:
if event.pressed:
var counter: Counter = game.inventory.get_counter(&"Gold")
if counter.value >= sheep_spawn_cost:
if sheep_spawner.spawn():
counter.decrease(sheep_spawn_cost)
func _physics_process(_delta: float) -> void:

View file

@ -1,17 +1,11 @@
[gd_scene load_steps=8 format=3 uid="uid://col1q3elvkfwk"]
[gd_scene load_steps=4 format=3 uid="uid://col1q3elvkfwk"]
[ext_resource type="Script" path="res://scenes/game/cursor.gd" id="1_1og6v"]
[ext_resource type="PackedScene" uid="uid://cu750c7yd57qa" path="res://scenes/game/gold_display.tscn" id="2_5c4iq"]
[ext_resource type="Script" path="res://behaviours/spawner.gd" id="3_tutfd"]
[ext_resource type="PackedScene" uid="uid://bc2bm8lbol18w" path="res://entities/sheep.tscn" id="4_7isfg"]
[ext_resource type="PackedScene" uid="uid://8jkesanu4hrn" path="res://behaviours/tracker.tscn" id="5_ewy4o"]
[sub_resource type="CircleShape2D" id="CircleShape2D_6ky4x"]
radius = 8.0
[sub_resource type="CircleShape2D" id="CircleShape2D_dc2ul"]
radius = 8.0
[node name="Cursor" type="Area2D" groups=["cursor"]]
z_index = 100
collision_layer = 128
@ -24,20 +18,3 @@ debug_color = Color(0, 0.411765, 0, 0)
[node name="GoldDisplay" parent="." instance=ExtResource("2_5c4iq")]
unique_name_in_owner = true
[node name="SheepSpawner" type="Node2D" parent="."]
unique_name_in_owner = true
script = ExtResource("3_tutfd")
scene = ExtResource("4_7isfg")
[node name="Tracker" parent="SheepSpawner" instance=ExtResource("5_ewy4o")]
collision_mask = 64
[node name="Shape" type="CollisionShape2D" parent="SheepSpawner/Tracker"]
shape = SubResource("CircleShape2D_dc2ul")
[connection signal="area_entered" from="SheepSpawner/Tracker" to="SheepSpawner/Tracker" method="track"]
[connection signal="area_exited" from="SheepSpawner/Tracker" to="SheepSpawner/Tracker" method="untrack"]
[connection signal="empty" from="SheepSpawner/Tracker" to="SheepSpawner" method="enable"]
[connection signal="tracked" from="SheepSpawner/Tracker" to="SheepSpawner/Tracker" method="log_tracked"]
[connection signal="tracked" from="SheepSpawner/Tracker" to="SheepSpawner" method="disable" unbinds=1]