How can I "unclick"?

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

I’m making a drag and drop game, but when the object enters the destination position, it is still movable if I don’t release the mouse click. Is there a way do “unclick” the object?

Could you provide a code snippet of what you have so far? And what do you mean by “if I don’t release the mouse click”? Is the object supposed to exit draggable state once it moves into the designated area?

johnygames | 2019-07-23 00:00

:bust_in_silhouette: Reply From: usurun

Are you looking for Input.is_action_just_released( "click" )

var clicked = false

if input.is_action_just_released( "click" ):
    clicked = !clicked

if clicked:
    "button pressed"
else:
    "button unpressed"