Godot Version
4.2.1
Question
Right now the player stands still while attacking which is fine and dandy. But the player can still swing from left to right rapidly. I want to change it so that when the player starts attacking they cant switch to the opposite direction
I am currently using a state machine for the player
In the player state code (used as the root for the player player states) there is a “can_move” variable that seems to stop all movement if true. But I can no longer find where it’s coded
Please ask if you need to see other code
Parent code for states:
class_name Player_State
extends Node
@export var can_move: bool = true
@onready var character = $"."
#used to call travel.playback (switches between animations in animationtree)
var playback : AnimationNodeStateMachinePlayback
var next_state : Player_State
#void functions
func state_process(_delta):
pass
func state_input(_event : InputEvent):
pass
#use inside the state that was just entered
func on_enter():
pass
func on_exit():
pass