Hook up robot + perfect-block stun + moving block zone!
This commit is contained in:
parent
1d6b5c35ca
commit
9dd2546613
6 changed files with 95 additions and 14 deletions
|
|
@ -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/ElevatorDoors/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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue