need to sleep
This commit is contained in:
parent
dafae35985
commit
211a5e074b
13 changed files with 381 additions and 15 deletions
|
|
@ -2,6 +2,9 @@ extends Node2D
|
|||
|
||||
@export var snake_man : Node2D
|
||||
@export var count : Label
|
||||
@export var my_area : Area2D
|
||||
@export var brain : Node2D
|
||||
var player_detected : bool
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
|
@ -11,3 +14,18 @@ func _ready() -> void:
|
|||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
count.text = str(snake_man.pit_apples)
|
||||
if my_area.get_overlapping_areas():
|
||||
player_detected = false
|
||||
for overlaps in my_area.get_overlapping_areas():
|
||||
if overlaps.is_in_group("braincell"):
|
||||
player_detected = true
|
||||
if player_detected:
|
||||
modulate = Color.GREEN
|
||||
else:
|
||||
modulate = Color.WHITE
|
||||
|
||||
|
||||
#print(str(player_detected) + " "+ str(snake_man.pit_apples) +" " +str(brain.holding_apple))
|
||||
if player_detected and snake_man.pit_apples > 0 and not brain.holding_apple:
|
||||
if Input.is_action_just_pressed("action"):
|
||||
Router.pickup_apple.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue