Compare commits
No commits in common. "5811658c644978ef91225c30f9844fbc2ce51e7a" and "8de3ee2c9a720bdc9b8f2c8eec88901dbed9db24" have entirely different histories.
5811658c64
...
8de3ee2c9a
|
|
@ -4,8 +4,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://dxluckxdkpv4f" path="res://molecular/molecular_player.tscn" id="3_b1jr0"]
|
[ext_resource type="PackedScene" uid="uid://dxluckxdkpv4f" path="res://molecular/molecular_player.tscn" id="3_b1jr0"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c3cuhrmulyy1s" path="res://molecular/assets/background/bg-near.png" id="4_b1jr0"]
|
[ext_resource type="Texture2D" uid="uid://c3cuhrmulyy1s" path="res://molecular/assets/background/bg-near.png" id="4_b1jr0"]
|
||||||
[ext_resource type="Script" uid="uid://ceut2lrvkns75" path="res://debug_label.gd" id="4_mys4o"]
|
[ext_resource type="Script" uid="uid://ceut2lrvkns75" path="res://debug_label.gd" id="4_mys4o"]
|
||||||
[ext_resource type="Script" uid="uid://umx4w11edif" path="res://molecular/prey_manager.gd" id="5_cthuy"]
|
[ext_resource type="Script" uid="uid://2pmjtnrg5471" path="res://molecular/preyManager.gd" id="5_ojt85"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c3iw2v3x6ngrb" path="res://molecular/nucleotide_prey.tscn" id="6_a5cls"]
|
|
||||||
|
|
||||||
[sub_resource type="TileMapPattern" id="TileMapPattern_a5cls"]
|
[sub_resource type="TileMapPattern" id="TileMapPattern_a5cls"]
|
||||||
tile_data = PackedInt32Array(0, 65536, 2, 65536, 65536, 3, 1, 131072, 2, 65537, 131072, 3)
|
tile_data = PackedInt32Array(0, 65536, 2, 65536, 65536, 3, 1, 131072, 2, 65537, 131072, 3)
|
||||||
|
|
@ -107,10 +106,5 @@ text = "Debug: You made it into the game!
|
||||||
This is running from C++: "
|
This is running from C++: "
|
||||||
script = ExtResource("4_mys4o")
|
script = ExtResource("4_mys4o")
|
||||||
|
|
||||||
[node name="PreyManager" type="Node" parent="." node_paths=PackedStringArray("cam")]
|
[node name="Prey" type="Node" parent="."]
|
||||||
script = ExtResource("5_cthuy")
|
script = ExtResource("5_ojt85")
|
||||||
cam = NodePath("../player/Camera2D")
|
|
||||||
scene = ExtResource("6_a5cls")
|
|
||||||
minCount = 500
|
|
||||||
maxCount = 1000
|
|
||||||
metadata/_custom_type_script = "uid://coetidfssb80w"
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://2pmjtnrg5471
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
extends SpawnManager2D
|
|
||||||
|
|
||||||
@export var cam: Camera2D
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
spawnRange = cam.get_viewport_rect()
|
|
||||||
_spawn_minimum()
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://umx4w11edif
|
|
||||||
|
|
@ -4,8 +4,6 @@ class_name NPC2D
|
||||||
@export var maxHealth: int = 0
|
@export var maxHealth: int = 0
|
||||||
var health: int = maxHealth
|
var health: int = maxHealth
|
||||||
|
|
||||||
signal died
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
spawn()
|
spawn()
|
||||||
|
|
@ -32,7 +30,6 @@ func feed(source ) -> void:
|
||||||
push_error("Function feed() not implemented.")
|
push_error("Function feed() not implemented.")
|
||||||
|
|
||||||
func die() -> void:
|
func die() -> void:
|
||||||
died.emit()
|
|
||||||
queue_free()
|
queue_free()
|
||||||
# TODO: should associate this class with a loot table (or equivalent), and can then implement logic for dying in parent class here.
|
# TODO: should associate this class with a loot table (or equivalent), and can then implement logic for dying in parent class here.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
[gd_scene load_steps=2 format=3 uid="uid://dje58m1cj34gn"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://coetidfssb80w" path="res://shared/npc/spawn_manager_2d.gd" id="1_624qc"]
|
|
||||||
|
|
||||||
[node name="SpawnManager2d" type="Node"]
|
|
||||||
script = ExtResource("1_624qc")
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
extends Node
|
|
||||||
class_name SpawnManager2D
|
|
||||||
|
|
||||||
#var scene = preload("res://molecular/nucleotide_prey.tscn")
|
|
||||||
@export var scene: PackedScene
|
|
||||||
@export var minCount = 1
|
|
||||||
@export var maxCount = 2
|
|
||||||
@export var spawnRange: Rect2
|
|
||||||
var _currentCount = 0
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
_spawn_minimum()
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _spawn_minimum() -> void:
|
|
||||||
while _currentCount < minCount and _currentCount < maxCount:
|
|
||||||
_spawn_random()
|
|
||||||
|
|
||||||
func _random_pos() -> Vector2:
|
|
||||||
return Vector2(randf_range(spawnRange.position[0], spawnRange.size[0]), randf_range(spawnRange.position[1], spawnRange.size[1]))
|
|
||||||
|
|
||||||
func _spawn_random() -> void:
|
|
||||||
var pos = _random_pos()
|
|
||||||
_spawn_creature(pos)
|
|
||||||
_currentCount += 1
|
|
||||||
|
|
||||||
func _spawn_creature(position: Vector2) -> void:
|
|
||||||
var instance = scene.instantiate()
|
|
||||||
instance.position = position
|
|
||||||
add_child(instance)
|
|
||||||
if instance.has_signal("died"):
|
|
||||||
instance.died.connect(_on_entity_died)
|
|
||||||
|
|
||||||
func _on_entity_died() -> void:
|
|
||||||
_currentCount = max(0, _currentCount-1)
|
|
||||||
_spawn_minimum()
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://coetidfssb80w
|
|
||||||
Loading…
Reference in New Issue