Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulating keypresses 4.1->4.2 regression #85984

Closed
Dan2552 opened this issue Dec 10, 2023 · 4 comments · Fixed by #86010
Closed

Simulating keypresses 4.1->4.2 regression #85984

Dan2552 opened this issue Dec 10, 2023 · 4 comments · Fixed by #86010

Comments

@Dan2552
Copy link

Dan2552 commented Dec 10, 2023

Tested versions

  • Reproducable in 4.2, 4.2.1-rc1
  • Not reproducable in 4.1.3

System information

macOS

Issue description

Input.parse_input_event and/or Input.flush_buffered_events not working as expected (or at least as previous)

Steps to reproduce

Create empty project, 2D scene, drag godot icon into scene to act as a Sprite2D node and add script:

extends Sprite2D

func _ready():
	setup_inputmap()
	press_left(true)

func _process(delta):
	var velocity = Vector2()

	if Input.is_action_pressed("left"):
		velocity.x -= 1

	velocity = velocity.normalized() * 200
	position += velocity * delta

func press_left(pressed: bool):
	var input_event = InputEventAction.new()
	input_event.action = "left"
	input_event.pressed = pressed
	Input.parse_input_event(input_event)
	Input.flush_buffered_events()

func setup_inputmap():
	var action_name = "left"
	InputMap.add_action(action_name)
	var event_key = InputEventKey.new()
	event_key.keycode = KEY_A
	InputMap.action_add_event(action_name, event_key)

In 4.1 the sprite will move left
In 4.2 the sprite will not move

Minimal reproduction project (MRP)

(attached is same as described in steps to reproduce)
playground2.zip

@Sauermann
Copy link
Contributor

Can confirm this issue on Windows.

@rsubtil
Copy link
Contributor

rsubtil commented Dec 10, 2023

Bisected to d9d0cfa (#84685), cc @KoBeWi

@davidkbd
Copy link

I just reproduced this issue too in Godot 4.2.1 (Manjaro Linux)

@barddev
Copy link

barddev commented Mar 29, 2024

On Mac, and can reproduce with Godot 4.2.1, 4.2.2.rc2, and 4.3.dev5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Very Bad
Development

Successfully merging a pull request may close this issue.

6 participants