Comments (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 anallowEcho
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.
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.
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)
- Add child node problem with selection. HOT 4
- Draw Skeleton2D gizmos independently of editor camera zoom HOT 3
- Starting from godot 3.6, materials generated from import gltf have its textures embebbed HOT 8
- .blend file import from Blender 4.2 files not working. HOT 2
- Animations saved with .res extension are not respecting bonemap on import
- 4.3beta3 NavigationRegion2D bake_navigation_polygon HOT 2
- Unable to Revoke Unique Name on Scene Root Node
- Problems with BoolVariable import in SCons 4.8.0 HOT 1
- Array type mismatch fails silently HOT 3
- Game Crash - Websocket issue on Android devices?
- root window.size_changed is not emitted when Stretch Mode is set to "viewport" HOT 2
- Getting False Positive "..Invalid call. Nonexistent function..." when running an EditorPlugin HOT 3
- Incorrect shading on normal mapped models with skeleton when using compatibility renderer HOT 4
- Changing `global groups` of a scene and going to another scene crashes the editor HOT 1
- After parser error, exported members become null (or NodePaths become empty) HOT 2
- [Visual Shader] Texture2dParameter node accepts instance qualifier. HOT 1
- [VisualShader] Default vec4 options are very hard to write to
- Godot hangs when using ".GetAwaiter().GetResult()" in overrided Godot's method (e.q. _Ready) HOT 1
- In code comments, single or double quote inside pair of brackets breaks bracket matching, showing brackets in red when near caret HOT 3
- Inverted shadows on web export when running in Safari HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot.