Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bacteria spawner #46

Merged
merged 2 commits into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Sick_Day_Delivery/Scenes/colony.tscn
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[gd_scene format=3 uid="uid://cl3gneduvqjdn"]
[gd_scene load_steps=3 format=3 uid="uid://bodh8ytr81wsh"]

[node name="colony" type="Node2D"]
[ext_resource type="Script" path="res://Scripts/colony.gd" id="1_7606h"]
[ext_resource type="PackedScene" uid="uid://bshn0kdmpqbnj" path="res://Scenes/bacterium.tscn" id="2_fxxkw"]

[node name="colony" type="Timer"]
script = ExtResource("1_7606h")
bacteriumScene = ExtResource("2_fxxkw")

[node name="Bacteria" type="Node" parent="."]

[connection signal="timeout" from="." to="." method="createBacterium"]
4 changes: 3 additions & 1 deletion Sick_Day_Delivery/Scenes/infection_spawner.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://cm82iie4k26u"]
[gd_scene load_steps=2 format=3 uid="uid://q78nn6ov4tkl"]

[ext_resource type="Script" path="res://Scripts/infection_spawner.gd" id="1_y6sr6"]

[node name="infection_spawner" type="Timer"]
script = ExtResource("1_y6sr6")

[node name="Colonies" type="Node" parent="."]

[connection signal="timeout" from="." to="." method="createColony"]
2 changes: 1 addition & 1 deletion Sick_Day_Delivery/Scenes/main.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_scene load_steps=8 format=3 uid="uid://b4xi3mlkhu4ow"]

[ext_resource type="PackedScene" uid="uid://bhh5dmfulsc0f" path="res://Scenes/body_map.tscn" id="1_6xrru"]
[ext_resource type="PackedScene" path="res://Scenes/body_map.tscn" id="1_6xrru"]
[ext_resource type="Script" path="res://Scripts/main.gd" id="1_mnr5t"]
[ext_resource type="PackedScene" uid="uid://cvpq0di0nimsq" path="res://Scenes/player_cell.tscn" id="2_dynj6"]
[ext_resource type="PackedScene" uid="uid://bshn0kdmpqbnj" path="res://Scenes/bacterium.tscn" id="3_vq0pw"]
Expand Down
20 changes: 20 additions & 0 deletions Sick_Day_Delivery/Scripts/colony.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends Timer

@export var bacteria_count := 1
@export_range(0, 20, 2) var spawn_rate: int
@export_range(0, 1, .025) var spawn_chance: float
@export var bacteriumScene: PackedScene

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

func createBacterium():
var bacterium = bacteriumScene.instantiate()
bacterium.position = self.position
add_child(bacterium)
7 changes: 5 additions & 2 deletions Sick_Day_Delivery/Scripts/infection_spawner.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extends Timer
@export var colony_count := 1
@export_range(0, 20, 2) var spawn_rate: int
@export_range(0, 1, .025) var spawn_chance: float
@export var colony: PackedScene
@export var colonyScene: PackedScene

var spawn_positions = [ Vector2(0,0), Vector2(50,50) ]

Expand All @@ -14,6 +14,9 @@ func _ready():

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var colony = colony.instantiate()
pass

func createColony():
var colony = colonyScene.instantiate()
colony.position = spawn_positions[0]
add_child(colony)