The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

func input(event):
if event.is
actionpressed("uiup") && event.isactionpressed("uileft"): //doesn't work
// both have underscore [ui
up,ui_left]

if event.isactionpressed("ui_up"): //worked

Godot version 3.4
in Engine by (37 points)
edited by

1 Answer

0 votes
Best answer

You're using event driven code; it won't fire for both events here (that is, including both events - likely one after the other). The event will hold one (and only one) input event (and/or modifiers, etc).

You could change the other check to Input, e.g.

if event.is_action_pressed("ui_up") && Input.is_action_pressed("ui_left"):
    # code

...and likewise for the ui_left event and pressed ui_up. Although I don't know what you're doing with the code here; likely you really want to apply some movement independently per frame; e.g. ui_up only applies some up value; ui_left some left; both should be applied when appropriate.

by (1,406 points)
selected by
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.