extends Node

@export var test := 100 
var paused = false

func _ready() -> void:
  GDRx.start_periodic_timer(1.0) \
      .subscribe(func(i): print("Tick: ", i)) \
      .dispose_with(self)
  GDRx.on_input_as_observable(self) \
    .filter(is_pause_event) \
    .filter(can_pause) \
    .throttle_first(1) \
    .subscribe(handle_pause) \
    .dispose_with(self)

func is_pause_event(event):
  if event is InputEventKey:
    #print(event)
    return event.is_action("Pause")

func can_pause(event):
  return false

func handle_pause(event):
  paused = !paused
  print("PAUSE: "+str(paused))
  get_tree().paused = paused

func move() -> void:
  pass
