Giter Site home page Giter Site logo

Comments (3)

bs-mwoerner avatar bs-mwoerner commented on August 15, 2024 3
  • The concept of repeating inputs typically only applies to keyboard keys. I don't think holding down a mouse button is supposed to produce repeated events in Godot (or most other frameworks).
  • IsActionPressed() has an allowEcho parameter that's false by default. Unless this is set to true, the method will only match the first event of a (keyboard key) repeat sequence.

To do something repeatedly while a condition is met, you can use a time-based approach via a timer or _PhysicsProcess() where you check the current state of the mouse button via the Input singleton.

from godot.

iLoveJohnFish avatar iLoveJohnFish commented on August 15, 2024

That's what i originally thought, however I tried changing the key action to "Key_J"(in my project settings) which is mapped to the 'J' key, and it still produces the same result.

I originally used the Input singleton, but that is simply not an option if i have GUI elements.

I have tried setting 'allowEcho = true', but I am still getting the same result.

Is there any way for me to handle my GUI input and player input seperately? It is a must have for my project.

from godot.

bs-mwoerner avatar bs-mwoerner commented on August 15, 2024

You can do something like this and get repeated 'ui_accept' prints when holding down the Enter key:

func _unhandled_input(event: InputEvent) -> void:
	if event.is_action_pressed("ui_accept", true):
		print('ui_accept')

This will still not repeat for mouse or gamepad buttons, though.

I don't know your particular use case, but the general advice is to process non-GUI input in _unhandled_input, so that it can be overridden by GUI controls. Depending on the type of game, it's also very common to handle player input in _process or _physics_process.

from godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.