I'm developing a word search game and currently stuck at input. In Godot while loop not possible for input function and input in process function. So it is not possible to drag a line like in word search program and clear the points if word doesn't match So while mouse pressed function not possible. Since we are using if for input function it will always be one point at a time and adding points will not be smooth

Here I'm talking about adding points to the line. The link you quoted is one for sprite. How are both even comparable. If you had used a word search game you would understand, what I mean.

The problem is the logic of your code, not Godot. The input won't change until the input function is finished; if the while loop is checking if the input has changed in the while loop, then the loop will run forever.

5 days later

@Hakunamawatta said: The problem is the logic of your code, not Godot. The input won't change until the input function is finished; if the while loop is checking if the input has changed in the while loop, then the loop will run forever.

don't you think it makes sense to have "while loop" for mouse button pressed. anyway i did a work around for my problem

So, while the button is pressed you want the rest of the program to stop?

@sstelkar said: don't you think it makes sense to have "while loop" for mouse button pressed. No, that's not what a while loop is for. You use a while loop if the state will change in the loop itself. The input will not change in the while loop.

5 days later

@Hakunamawatta said:

@sstelkar said: don't you think it makes sense to have "while loop" for mouse button pressed. No, that's not what a while loop is for. You use a while loop if the state will change in the loop itself. The input will not change in the while loop.

okay tell me how do you get the start and end point of a single drag

@Megalomaniak said: So, while the button is pressed you want the rest of the program to stop?

i want the start and end position of a single drag

I'm not sure what you are doing, but coroutines are used for waiting for an event to finish. You might want to check them out in the docs. However, you can't put them in a process function, which is probably your problem with using them in a while loop.

a year later