godot check left mouse button

To check if the left mouse button is pressed in GDScript, you can use the Input class. Here's an example of how you can do it:

func _process(delta: float) -> void:
    if Input.is_action_pressed("ui_left_click"):
        # Left mouse button is pressed
        pass

In this example, we use the _process function which is called every frame. Inside this function, we check if the "ui_left_click" action is pressed using the is_action_pressed method of the Input class. If the left mouse button is pressed, we can perform some action or logic.

Remember to define the "ui_left_click" action in the Input Map settings of your project. You can assign it to the left mouse button or any other input event you prefer.

That's it! This code will allow you to check if the left mouse button is pressed in GDScript.