summaryrefslogtreecommitdiff
path: root/Scripts
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2024-04-14 11:28:24 +0700
committeraltaf-creator <dev@altafcreator.com>2024-04-14 11:28:24 +0700
commit21d3893b6b1c1ffb2d9611bce67568e713161b3d (patch)
tree1360007e7b378e84be3c7d9d596bdcce7c0f8a48 /Scripts
parentb97ebd793eb17032f3929f307dfe644b17714619 (diff)
IncreaseSize.gd — UNFINISHED, i have to go
Diffstat (limited to 'Scripts')
-rw-r--r--Scripts/AI.gd6
-rw-r--r--Scripts/GameLoop.gd8
2 files changed, 12 insertions, 2 deletions
diff --git a/Scripts/AI.gd b/Scripts/AI.gd
index d5cbcbe..1428c06 100644
--- a/Scripts/AI.gd
+++ b/Scripts/AI.gd
@@ -2,6 +2,7 @@ extends Node
class_name AI
@export_group("Values")
+@export var max_distance : float
@export_group("Scenes")
@export var shape_cast_original : ShapeCast2D
@@ -34,4 +35,7 @@ func step(alternative : bool = false):
if nodes.size() > 0:
nodes[0].join_from($"..")
else:
- step(true)
+ if !alternative:
+ step(true)
+ else:
+ print("i am softlocked!")
diff --git a/Scripts/GameLoop.gd b/Scripts/GameLoop.gd
index 04cd370..e5cf08e 100644
--- a/Scripts/GameLoop.gd
+++ b/Scripts/GameLoop.gd
@@ -3,12 +3,15 @@ class_name GameLoop
@export var turns : int
@export var label : Label
+@export_file var level : String
+
var current_turns : int = 0
var prev_turn : int = -1
# Called when the node enters the scene tree for the first time.
func _ready():
GlobalVariables.gameloop = self
+ current_turns = 0
func _process(_delta):
if current_turns >= turns:
@@ -17,4 +20,7 @@ func _process(_delta):
if prev_turn != current_turns:
prev_turn = current_turns
label.text = "Turns Left: " + str(turns - current_turns)
- GlobalVariables.ai.step()
+ if current_turns != 0: GlobalVariables.ai.step()
+
+ if Input.is_action_just_pressed("reset"):
+ get_tree().change_scene_to_file(level)