+1 vote

Hi, I'm just trying to change to a new scene in a simple way with a signal, and I'm having an weird? issue:

Main scene:
Node2d > Button (with signal):

func _on_Button_pressed():

Secondary scene:

func _ready():
   print('ready board');

func _process(delta):

func _read_input():
   if (Input.is_action_just_released("left_click")):

When I click mouse left button in Main scene, everything works fine, and Secondary scene is presented on screen, but left_click released is read, so the code inside the if is executed. I would like to avoid this from happening.

Could anybody help me please? I don't know what I'm doing wrong.

Code to blame: https://drive.google.com/file/d/1QvU-8qH0AZ_LBM691J8FB3EPMqpQZ71q/view?usp=sharing

Godot version 3.3.4 stable
in Engine by (16 points)

1 Answer

0 votes
Best answer

Scene is changed while You hold mouse button and You release it after new scene is loaded. This is what You chose as Input - button released. It is best to design Input map otherwise, can't You use just_pressed() instead of released? Why is this an issue, what do You want to happen on button release in your secondary scene ?

by (8,099 points)
selected by

did the work. Thanks.

I think that at the beginning I used that method, but I did some alterations to the original code, because I tried to use left & right click at the same time, and also release both at the same time, and I completely forgot about that method.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.