2021-10-02 11:12:27 -04:00
|
|
|
extends Area2D
|
2021-05-16 21:33:16 -04:00
|
|
|
|
|
|
|
onready var zone = $Sprite
|
|
|
|
onready var quarters = $Quarters
|
2021-05-20 04:54:00 -04:00
|
|
|
onready var animator = $AnimationPlayer
|
2021-05-16 21:33:16 -04:00
|
|
|
|
|
|
|
var can_grab = false
|
|
|
|
var grabbed_offset = Vector2()
|
|
|
|
|
|
|
|
func _ready():
|
2023-01-21 05:45:38 -05:00
|
|
|
zone.frame = 0
|
|
|
|
|
|
|
|
#func _drag_drop(event):
|
|
|
|
# if event is InputEventMouseButton and can_grab:
|
|
|
|
# # Substract from the player's budget and disable grabbing
|
|
|
|
# if SimData.budget >= cost:
|
|
|
|
# SimData.budget -= cost
|
|
|
|
# can_grab = false
|
|
|
|
# grabbed_offset = position - get_global_mouse_position()
|
|
|
|
|
|
|
|
#func _input(event):
|
|
|
|
# _drag_drop(event)
|
2021-05-16 21:33:16 -04:00
|
|
|
|
2021-05-20 00:58:17 -04:00
|
|
|
func _process(delta):
|
2023-01-21 05:45:38 -05:00
|
|
|
if SimData.has_power == true:
|
2021-05-20 04:54:00 -04:00
|
|
|
animator.play("Animante")
|
2021-05-20 00:58:17 -04:00
|
|
|
else:
|
2021-05-20 04:54:00 -04:00
|
|
|
animator.stop()
|
2023-01-21 05:45:38 -05:00
|
|
|
# if can_grab:
|
|
|
|
# position = get_global_mouse_position() + grabbed_offset
|
2021-05-20 00:58:17 -04:00
|
|
|
|
2023-01-21 05:45:38 -05:00
|
|
|
#func _animante_sprite(animante: bool = true):
|
|
|
|
# if zone.hframes > 1 or zone.vframes > 1 and animante:
|
|
|
|
# animator.play("Animante")
|
|
|
|
# else:
|
|
|
|
# animator.stop()
|
|
|
|
|
|
|
|
#func _grab_zone():
|
|
|
|
# can_grab = true
|