diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/clickable_area.gd | 9 | ||||
-rw-r--r-- | lib/ticked.gd | 13 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/clickable_area.gd b/lib/clickable_area.gd new file mode 100644 index 0000000..c9e49d7 --- /dev/null +++ b/lib/clickable_area.gd @@ -0,0 +1,9 @@ +extends Area2D +class_name ClickableArea + +func _click(): + pass + +func _input_event(viewport, event, shape_idx): + if event is InputEventMouseButton and event.button_index == BUTTON_LEFT and event.is_pressed(): + _click() diff --git a/lib/ticked.gd b/lib/ticked.gd new file mode 100644 index 0000000..cef46ab --- /dev/null +++ b/lib/ticked.gd @@ -0,0 +1,13 @@ +extends Node +class_name Ticked + +export var tick_rate := 1.0 +var current_tick = 0.0 +func _tick(): + pass + +func _process(delta: float) -> void: + current_tick += delta + while current_tick > tick_rate: + _tick() + current_tick -= tick_rate |