This commit is contained in:
Henry 2026-05-10 20:41:20 +01:00
commit 2b20458de7
6 changed files with 100 additions and 15 deletions

View file

@ -4,30 +4,38 @@ var robot_delay = randf_range(3.5,7)
var robot_ready: bool = false
var robot_win: bool = false
var speed: int = 3.5
var doors_open: bool = false
var stun_remaining: float = 0.0
@onready var safety_zone = get_node("/root/Game/World/ElevatorSafeZone")
func _ready() -> void:
EventBus.doors_opened.connect(func(): doors_open = true)
EventBus.doors_closed.connect(func(): doors_open = false)
EventBus.robot_stun_requested.connect(func(d: float): stun_remaining += d)
await get_tree().create_timer(robot_delay).timeout
robot_ready = true
func _physics_process(delta):
if robot_win == true: return
if robot_ready == false: return
if stun_remaining > 0.0:
stun_remaining -= delta
return
if robot_ready == true:
velocity.z -= speed * delta
move_and_slide()
if robot_win == true: return
func _on_area_3d_area_entered(area: Area3D) -> void:
var safety = safety_zone
if area == safety: #TODO: if entered safety AND door is open, then GAME OVER!
if area == safety and doors_open:
robot_win = true
print("got you!")
EventBus.game_lost.emit("ROBOT GOT IN")