How do you fire something with Input.is_action_just_released?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By javrocks
extends KinematicBody2D

func _physics_process(delta):

    var direction = Vector2.RIGHT.rotated(rotation)
    if Input.is_action_just_released("ui_touch"):
        global_position += move_and_slide(SPEED * direction * delta)
       

what this code does is it moves the object in the direction that it’s rotated in but
the object dosen’t go far because the input is just_released
I need the object to move when i release ui_touch. Is there anyway to do this?

:bust_in_silhouette: Reply From: exuin

Have a boolean variable that represents whether the node is moving or not. Set it to true when the key is released, and only move the node if it’s true.

It’s working thanks

javrocks | 2021-09-04 14:59