ft: wrapping manager overhaul

This commit is contained in:
2026-03-01 14:11:28 +01:00
parent 99de1fc113
commit f83b290f5c
24 changed files with 221 additions and 182 deletions

View File

@@ -1,5 +1,5 @@
extends CharacterBody2D
class_name NPC2D
extends Node
class_name NPC
@export var maxHealth: int = 0
var health: int = maxHealth

View File

@@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://biup0eej85fq2"]
[ext_resource type="Script" uid="uid://biu3sctw15ga" path="res://shared/npc/abstractNPC.gd" id="1_xlqdr"]
[node name="NPC" type="Node" unique_id=272773627]
script = ExtResource("1_xlqdr")

View File

@@ -1,5 +1,5 @@
extends NPC2D
class_name AbstractPredator2D
extends NPC
class_name AbstractPredator
# Called when the node enters the scene tree for the first time.
func _ready() -> void:

View File

@@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://b7wqd5owafn6g"]
[ext_resource type="PackedScene" uid="uid://biup0eej85fq2" path="res://shared/npc/npc2D.tscn" id="1_4llks"]
[ext_resource type="Script" uid="uid://dgfimmq53whll" path="res://shared/npc/predator2D.gd" id="2_rj1ok"]
[ext_resource type="PackedScene" uid="uid://biup0eej85fq2" path="res://shared/npc/abstractNPC.tscn" id="1_4llks"]
[ext_resource type="Script" uid="uid://dgfimmq53whll" path="res://shared/npc/abstractPredator.gd" id="2_rj1ok"]
[node name="AbstractPredator" unique_id=912624667 instance=ExtResource("1_4llks")]
script = ExtResource("2_rj1ok")

View File

@@ -1,5 +1,5 @@
extends NPC2D
class_name AbstractPrey2D
extends NPC
class_name AbstractPrey
# Called when the node enters the scene tree for the first time.

View File

@@ -0,0 +1,7 @@
[gd_scene format=3 uid="uid://bvsdg1v3ksixy"]
[ext_resource type="PackedScene" uid="uid://biup0eej85fq2" path="res://shared/npc/abstractNPC.tscn" id="1_fdrej"]
[ext_resource type="Script" uid="uid://76jxpubyd8wp" path="res://shared/npc/abstractPrey.gd" id="2_xkhwn"]
[node name="AbstractPrey" unique_id=1075345151 instance=ExtResource("1_fdrej")]
script = ExtResource("2_xkhwn")

View File

@@ -1,10 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://biup0eej85fq2"]
[ext_resource type="Script" uid="uid://biu3sctw15ga" path="res://shared/npc/npc2D.gd" id="1_ucjfp"]
[node name="NPC" type="CharacterBody2D"]
script = ExtResource("1_ucjfp")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
position = Vector2(7.215866, -0.5034294)
polygon = PackedVector2Array(-8.831272, -2.3390446, -5.7760534, -2.3993049, -4.0230684, 0.41277456, -5.8890305, 2.9948444, -8.862037, 2.9326901, -10.268076, 0.28495264)

View File

@@ -1,7 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://bvsdg1v3ksixy"]
[ext_resource type="PackedScene" uid="uid://biup0eej85fq2" path="res://shared/npc/npc2D.tscn" id="1_2m1le"]
[ext_resource type="Script" uid="uid://76jxpubyd8wp" path="res://shared/npc/prey2D.gd" id="2_dny00"]
[node name="AbstractPrey" instance=ExtResource("1_2m1le")]
script = ExtResource("2_dny00")

View File

@@ -30,7 +30,7 @@ func _spawn_random() -> void:
func _spawn_creature(position: Vector2) -> void:
var instance = scene.instantiate()
instance.position = position
instance.set_position(position)
add_child(instance)
if instance.has_signal("died"):
#instance.died.connect(GameManager.foodManager._spawn_food_on_position)