30 lines
994 B
GDScript
30 lines
994 B
GDScript
class_name Rogue extends Player
|
|
|
|
var attacks := ["2H_Ranged_Shoot"]
|
|
var reloadings := ["2H_Ranged_Reload"]
|
|
var aimings := ["2H_Ranged_Aiming"]
|
|
var footsteps := [
|
|
"res://resources/audio/footstep_grass_000.ogg",
|
|
"res://resources/audio/footstep_grass_001.ogg",
|
|
"res://resources/audio/footstep_grass_002.ogg",
|
|
"res://resources/audio/footstep_grass_003.ogg",
|
|
"res://resources/audio/footstep_grass_004.ogg"
|
|
]
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
# Shoot
|
|
if event.is_action_pressed("attack"):
|
|
if enough_stamina_available(attack_cost):
|
|
use_stamina(attack_cost)
|
|
anim_state.travel(attacks.pick_random())
|
|
|
|
# Reload
|
|
if Input.is_action_pressed("reload"):
|
|
anim_state.travel(reloadings.pick_random())
|
|
|
|
# Aiming
|
|
if Input.is_action_pressed("block"): state = States.aiming
|
|
if Input.is_action_just_released("block"): state = States.idle
|
|
anim_tree.set("parameters/conditions/aiming", state == States.aiming)
|
|
anim_tree.set("parameters/conditions/not_aiming", state != States.aiming)
|