diff options
author | Roman Gräf <romangraef@gmail.com> | 2020-04-18 12:18:38 +0200 |
---|---|---|
committer | Roman Gräf <romangraef@gmail.com> | 2020-04-18 12:18:38 +0200 |
commit | d3e26b3e2263770faa493e39caccab4dfe81fb17 (patch) | |
tree | 45d074bcce40b02f159276169eac4a448c789c8f /lib | |
parent | f6762253e43fc8dd782b026f4014d62350845ea5 (diff) | |
download | LDJam46-d3e26b3e2263770faa493e39caccab4dfe81fb17.tar.gz LDJam46-d3e26b3e2263770faa493e39caccab4dfe81fb17.tar.bz2 LDJam46-d3e26b3e2263770faa493e39caccab4dfe81fb17.zip |
Programmierer und Riots
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 |