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

WIP: Bugfix/i578 #587

Merged
merged 2 commits into from
Jul 9, 2024
Merged

WIP: Bugfix/i578 #587

merged 2 commits into from
Jul 9, 2024

Conversation

lxkarp
Copy link
Contributor

@lxkarp lxkarp commented Apr 3, 2024

The hope here is to resolve #578

I haven't done any cleanup as suggested by @bitwes over in the issue thread. But the fix he suggested works just fine, and this PR is evidence of that.

@lxkarp
Copy link
Contributor Author

lxkarp commented Apr 3, 2024

I think this may not correctly trigger is_action_just_pressed. I'll make another test to validate this tomorrow.

@Kulkodar
Copy link

Kulkodar commented Apr 4, 2024

Now i feel a little bit ashamed i could have submitted a pr but i didn't found the time. Thank you for taking the initiative, with these changes all my tests are working again. It seems that ´is_action_just_pressed´ is working.

@lxkarp
Copy link
Contributor Author

lxkarp commented Apr 4, 2024

I found that the problem with is_action_just_pressed -- for me at least -- is that it doesn't work in _process but it does work in _physics_process

ArSn added a commit to ArSn/godot-dodge-the-creeps-2d that referenced this pull request Apr 14, 2024
… Input global Singleton again. See: bitwes/Gut#587

Then, adjusted test for moving the player right to actually work instead of just fooling myself with the newly set position. :)
Copy link
Owner

@bitwes bitwes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. The code change looks good. I'd like some additional testing to verify that the Input.is_action_just_* methods work as expected. If you change the InputSingletonTracker to the code below, you should be able to make assertions that they are working.

NOTE When I tried verifying that is_action_just_pressed was working I had to add a leading wait_frames for the InputSingletonTracker to detect the frame when the action goes down

_sender.wait_frames(1).action_down("jump").hold_for('10f')
await wait_for_signal(_sender.idle, 5)

Here's my take on InputSingletonTracker

class InputSingletonTracker:
	extends Node
	var pressed_frames = []
	var just_pressed_count = 0
	var just_released_count = 0

	var _frame_counter = 0

	func _process(delta):
		_frame_counter += 1

		if(Input.is_action_just_pressed("jump")):
			just_pressed_count += 1

		if(Input.is_action_just_released("jump")):
			just_released_count += 1

		if Input.is_action_pressed("jump"):
			pressed_frames.append(_frame_counter)

@Edearth Edearth mentioned this pull request Jul 5, 2024
@bitwes bitwes merged commit 2c061c9 into bitwes:main Jul 9, 2024
@bitwes
Copy link
Owner

bitwes commented Jul 9, 2024

Hey @lxkarp. @Edearth added the requested tests so I'm merging this PR for street cred, then I'll merge theirs. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Input does not seem to receive events from an InputSender
4 participants