summaryrefslogtreecommitdiff
path: root/Spatial.gd
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-11-15 00:41:40 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-11-15 00:41:40 +0100
commit4114d3122f00829e6b53fdb5490b7568d688c1c6 (patch)
treed3cb8d1301f9ce0998119e811069ebb1199a87ac /Spatial.gd
parent073d2019f6cc295aff9ca59f77dae77c1cdfdb06 (diff)
downloadnj26-4114d3122f00829e6b53fdb5490b7568d688c1c6.tar.gz
Force + fix zombie lights
Diffstat (limited to 'Spatial.gd')
-rw-r--r--Spatial.gd48
1 files changed, 31 insertions, 17 deletions
diff --git a/Spatial.gd b/Spatial.gd
index 521046e..8ba3419 100644
--- a/Spatial.gd
+++ b/Spatial.gd
@@ -26,8 +26,8 @@ func set_points(box, points):
on_points()
# jailpos -= Vector3(0, points * 0.375, 0)
- # jailpos -= Vector3(0, points * 0.45, 0)
- jailpos -= Vector3(0, points * 3, 0)
+ jailpos -= Vector3(0, points * 0.45, 0)
+ # jailpos -= Vector3(0, points * 3, 0)
func _entered(box):
set_points(box, 1)
@@ -36,11 +36,12 @@ func _exited(box):
set_points(box, -1)
func on_points():
- $CanvasLayer/blue.text = "Team Blue: %d" % blue_points
- $CanvasLayer/pink.text = "Team Pink: %d" % pink_points
+ $CanvasLayer/cc/hb/blue.text = "Team Blue: %d" % blue_points
+ $CanvasLayer/cc/hb/pink.text = "Team Pink: %d" % pink_points
func _create_cat():
var cat = load("res://cat.tscn").instance()
+ cat.translate(Vector3(0, -1, 0))
add_child(cat)
func _physics_process(delta):
@@ -64,17 +65,17 @@ func _physics_process(delta):
z.run_powerup(boxes, zombies)
func randpos(y = 10):
- var maxp = 7.0
- var minp = 6.0
+ var maxp = 6.8
+ var minp = 5.0
var x = randf() * maxp
var z = randf() * maxp
- if x < minp and z > minp:
- x += minp
- x = fmod(x, maxp)
- elif z < minp:
- z += minp
- z = fmod(z, maxp)
+ if randi() & 1:
+ while x > maxp or (x < minp and z < minp):
+ x = randf() * maxp
+ else:
+ while z > maxp or (z < minp and x < minp):
+ z = randf() * maxp
if randi() & 1:
x = -x
@@ -82,6 +83,7 @@ func randpos(y = 10):
if randi() & 1:
z = -z
+ print(Vector3(x, y, z))
return Vector3(x, y, z)
func create_box(team):
@@ -126,7 +128,7 @@ func create_powerup():
func _on_powerup_timeout():
create_powerup()
- $powerup_timer.start(randi() % 31 + 1)
+ $powerup_timer.start(randi() % 16 + 5)
func game_over():
pass
@@ -142,8 +144,18 @@ func _process(delta):
text += "%02d" % minutes
text += ":%02d" % seconds
- $CanvasLayer/time_left.text = text
- pass
+ $CanvasLayer/cc/hb/time_left.text = text
+
+func _on_box_timeout():
+ var team
+
+ if randi() & 1:
+ team = t.Team.BLUE
+ else:
+ team = t.Team.PINK
+
+ create_box(team)
+ $box_timer.start(randi() % 16 + 5)
func _ready():
randomize()
@@ -154,7 +166,7 @@ func _ready():
create_zombie(2, t.Team.PINK, Vector3(6.0, 0, -3))
create_zombie(3, t.Team.PINK, Vector3(6.0, 0, 3))
- for _i in range(randi() % 16 + 8):
+ for _i in range(randi() % 4 + 1):
create_powerup()
for _i in range(15):
@@ -164,7 +176,9 @@ func _ready():
create_box(t.Team.BLUE)
$powerup_timer.connect("timeout", self, "_on_powerup_timeout")
- $powerup_timer.start(randi() % 31 + 1)
+ $powerup_timer.start(randi() % 16 + 5)
+ $box_timer.start(randi() % 16 + 5)
+ $box_timer.connect("timeout", self, "_on_box_timeout")
$game_time.start(120)
$game_time.connect("timeout", self, "game_over")
connect("new_points", self, "on_points")