From 258ed783925c9f1f604eadc92ed8972e51420587 Mon Sep 17 00:00:00 2001 From: BenHerbst Date: Thu, 26 May 2022 23:41:25 +0200 Subject: [PATCH] User can hold bluescreen so it stops --- animation_player.gd | 10 ++++++++++ main.tscn | 4 +++- project.godot | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 animation_player.gd diff --git a/animation_player.gd b/animation_player.gd new file mode 100644 index 0000000..e7f19c7 --- /dev/null +++ b/animation_player.gd @@ -0,0 +1,10 @@ +extends AnimationPlayer + + +func _process(delta): + if Input.is_action_just_pressed("hold"): + # holds the percentage animation / plays it again when currently holded + if is_playing(): + stop(false) + else: + play() diff --git a/main.tscn b/main.tscn index b7d5189..43cd01a 100644 --- a/main.tscn +++ b/main.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://Roboto-Regular.ttf" type="DynamicFontData" id=1] [ext_resource path="res://qrcode.png" type="Texture" id=2] [ext_resource path="res://main.gd" type="Script" id=3] +[ext_resource path="res://animation_player.gd" type="Script" id=4] [sub_resource type="DynamicFont" id=2] size = 70 @@ -155,5 +156,6 @@ stretch_mode = 6 autoplay = "start" anims/RESET = SubResource( 6 ) anims/start = SubResource( 5 ) +script = ExtResource( 4 ) [connection signal="gui_input" from="." to="." method="_on_Control_gui_input"] diff --git a/project.godot b/project.godot index 59b5175..70f592f 100644 --- a/project.godot +++ b/project.godot @@ -21,6 +21,14 @@ config/icon="res://icon.png" window/size/fullscreen=true +[input] + +hold={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":72,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} + [physics] common/enable_pause_aware_picking=true