What do you guys think of my final version of the movement system. any reccomendations

extends KinematicBody2D

movement console.

onready var full_speed = 250 onready var initial_speed = 83.3 onready var gravity = 60 onready var jump_height = -950

player check console.

onready var isattack = false onready var isrolling = false onready var isblocking = false

var combo_pts = 3

subtracts for each combo animation played (1-3)

var up = Vector2(1,-1) var motion = Vector2(0,0)

get node console

onready var anim = $AnimatedSprite onready var col_attack = $Attack/CollisionShape2D onready var col_block = $Block/CollisionShape2D onready var time := $Timer

funcion run by physics and frames

func _physics_process(delta): movement() attack() block() turn_dir()

func turn_dir(): if motion.x > 0: anim.flip_h = false roll()

if motion.x < 0:
        anim.flip_h = true
        roll()

func movement(): motion.y += gravity motion = move_and_slide(motion, up) var friction = false # activates interpolation physics

if Input.is_action_pressed("right") && isattack == false && isblocking == false && isrolling == false:
    anim.play("move")
    col_attack.position.x = 30
    col_block.position.x = 0
    motion.x = min(motion.x + initial_speed, + full_speed)

elif Input.is_action_pressed("left")  && isattack == false && isblocking == false && isrolling == false:
    anim.play("move")
    col_attack.position.x = -30
    col_block.position.x = 0
    motion.x = max(motion.x - initial_speed, - full_speed)

else:
    if isattack == false && isblocking == false && isrolling == false:
        motion.x = 0
        anim.play("idle")

if is_on_floor():
    if Input.is_action_just_pressed("up") && isattack == false && isblocking == false && isrolling == false:
        motion.y = jump_height
    if friction == true:
        motion.x = lerp(motion.x , 0 , 0.5)
else:
    if isattack == false && isblocking == false && isrolling == false:
        if motion.y < 0:
            anim.play("jump") 
        else:
            anim.play("fall")
            if friction == true:
                motion.x = lerp(motion.x , 0 , 0.1)

func roll(): if is_on_floor(): if Input.is_action_just_pressed("roll") && isattack == false && isblocking == false: isrolling = true anim.play("roll")

Roll speed is captured through player full speed.

what ever side player is facing. the roll animation will move into that direction

func block(): if is_on_floor(): if Input.is_action_just_pressed("block") && isattack == false && isrolling == false: motion.x = 0 anim.play("block_wait") isblocking = true col_block.disabled = true

func attack(): if Input.is_action_just_pressed("attack") && isattack == false && isblocking == false && combo_pts == 3 && isrolling == false: combo_pts = combo_pts - 1 motion.x = 0 isattack = true col_attack.disabled = false anim.play("combo_1") time.start() if Input.is_action_just_pressed("attack") && isattack == false && isblocking == false && combo_pts == 2 && isrolling == false: combo_pts = combo_pts - 1 motion.x = 0 isattack = true col_attack.disabled = false time.start() anim.play("combo_2") if Input.is_action_just_pressed("attack") && isattack == false && isblocking == false && combo_pts == 1 && isrolling == false: combo_pts = combo_pts - 1 motion.x = 0 isattack = true col_attack.disabled = false time.start() anim.play("combo_3")

func _on_AnimatedSprite_animation_finished(): if anim.animation == "combo_1": isattack = false isblocking = false isrolling = false col_attack.disabled = true col_block.disabled = true if anim.animation == "combo_2": motion.x *=-1 isattack = false isblocking = false isrolling = false col_attack.disabled = true col_block.disabled = true if anim.animation == "combo_3": isattack = false isblocking = false isrolling = false col_attack.disabled = true col_block.disabled = true if anim.animation == "block_wait": isattack = false isblocking = false isrolling = false col_block.disabled = false if anim.animation == "roll": isattack = false isblocking = false isrolling = false

func _on_Timer_timeout(): combo_pts = 3

/r/godot Thread Link - v.redd.it