gd: added input addon
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
# This component shows a progress bar for the hold time, indicating to the player
|
||||
# that they must keep touching the screen until something is placed.
|
||||
extends Node2D
|
||||
|
||||
@export var spawn:GUIDEAction
|
||||
@onready var texture_progress_bar:TextureProgressBar = %TextureProgressBar
|
||||
|
||||
func _ready():
|
||||
visible = false
|
||||
# While the hold trigger is evaluating show the progress bar
|
||||
spawn.ongoing.connect(_show)
|
||||
# Once it is done, hide it again
|
||||
spawn.triggered.connect(_hide)
|
||||
# Same when it was cancelled
|
||||
spawn.cancelled.connect(_hide)
|
||||
|
||||
func _show():
|
||||
# show the indicator
|
||||
visible = true
|
||||
# move it to where we would spawn
|
||||
global_position = spawn.value_axis_2d
|
||||
# and update the progress bar
|
||||
texture_progress_bar.value = spawn.elapsed_seconds
|
||||
|
||||
func _hide():
|
||||
visible = false
|
@ -0,0 +1 @@
|
||||
uid://cnb3sumemposh
|
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c1ht6xduduxri"]
|
||||
|
||||
[ext_resource type="Script" path="res://guide_examples/touch/placement_indicator/placement_indicator.gd" id="1_gnpc8"]
|
||||
[ext_resource type="Resource" uid="uid://iilpc2tjr5mx" path="res://guide_examples/touch/mapping_contexts/actions/spawn.tres" id="2_grp35"]
|
||||
[ext_resource type="Texture2D" uid="uid://geq3rs2fxqs4" path="res://guide_examples/touch/placement_indicator/radial_progress.png" id="2_slqs6"]
|
||||
|
||||
[node name="PlacementIndicator" type="Node2D"]
|
||||
script = ExtResource("1_gnpc8")
|
||||
spawn = ExtResource("2_grp35")
|
||||
|
||||
[node name="TextureProgressBar" type="TextureProgressBar" parent="."]
|
||||
unique_name_in_owner = true
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -96.0
|
||||
offset_top = -96.0
|
||||
offset_right = 96.0
|
||||
offset_bottom = 96.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
max_value = 1.0
|
||||
step = 0.0
|
||||
fill_mode = 4
|
||||
texture_progress = ExtResource("2_slqs6")
|
BIN
guide_examples/touch/placement_indicator/radial_progress.png
Normal file
BIN
guide_examples/touch/placement_indicator/radial_progress.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://geq3rs2fxqs4"
|
||||
path="res://.godot/imported/radial_progress.png-a1f0b05f25628c67f45ec0be27847631.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://guide_examples/touch/placement_indicator/radial_progress.png"
|
||||
dest_files=["res://.godot/imported/radial_progress.png-a1f0b05f25628c67f45ec0be27847631.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
Reference in New Issue
Block a user