mirror of
https://github.com/Steffo99/looping-for-loops.git
synced 2024-11-29 03:24:20 +00:00
31 lines
557 B
GDScript
31 lines
557 B
GDScript
extends KinematicBody2D
|
|
class_name GhostBlock
|
|
|
|
export(bool) var is_active: bool = true setget set_active
|
|
|
|
|
|
func _ready():
|
|
set_active_no_anim(is_active)
|
|
|
|
|
|
func set_active_no_anim(value):
|
|
$CollisionShape2D.disabled = not value
|
|
is_active = value
|
|
|
|
|
|
func set_active(value):
|
|
if not is_active and value:
|
|
$AnimationPlayer.play("Appear")
|
|
elif is_active and not value:
|
|
$AnimationPlayer.play_backwards("Appear")
|
|
set_active_no_anim(value)
|
|
|
|
|
|
func activate():
|
|
set_active(true)
|
|
|
|
func deactivate():
|
|
set_active(false)
|
|
|
|
func toggle():
|
|
set_active(not is_active)
|