gd: added input addon

This commit is contained in:
2025-05-27 19:20:46 +02:00
parent d8a1604af9
commit c8d8c7ec25
683 changed files with 21608 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c22k1y6rbntlw"
path="res://.godot/imported/mrg0000.png-2c8ef2c24386191b7c1a03703c595faf.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://guide_examples/top_down_shooter/player/mrg0000.png"
dest_files=["res://.godot/imported/mrg0000.png-2c8ef2c24386191b7c1a03703c595faf.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

View File

@ -0,0 +1,46 @@
extends CharacterBody2D
@export var speed:float = 300
@export var look_relative:GUIDEAction
@export var look_absolute:GUIDEAction
@export var move:GUIDEAction
@export var fire:GUIDEAction
@export var bolt:PackedScene
@onready var left_hand:Node2D = %LeftHand
@onready var right_hand:Node2D = %RightHand
func _ready():
# fire some bolts when the fire action triggers
fire.triggered.connect(_fire)
func _physics_process(delta):
var target = Vector2.INF
# Looking at absolute coordinates. This is the case when we use a mouse.
if look_absolute.is_triggered():
target = look_absolute.value_axis_2d
# Looking at relative coordinates. This is the case when we use a controller
elif look_relative.is_triggered():
target = global_position + look_relative.value_axis_2d
# If we have a target, rotate towards it
if target.is_finite():
var target_orientation = Transform2D()\
.translated(transform.origin)\
.looking_at(target)
transform = transform.interpolate_with(target_orientation, 5 * delta)
# and move according to the input.
velocity = speed * move.value_axis_2d
move_and_slide()
func _fire():
# for each hand of the player, spawn a bolt
for hand in [left_hand, right_hand]:
var a_bolt:Node2D = bolt.instantiate()
get_parent().add_child(a_bolt)
a_bolt.global_transform = hand.global_transform

View File

@ -0,0 +1 @@
uid://blx1seoclt48w