HaxeFlixel / HaxeFlixel/flixel
GamePad input not reset when entering substate
Nobody has claimed this yet.
- Dominant language
- Haxe
- Stars
- 2.2k
- Forks
- 522
- Avg merge
- 34m
- Merged PRs (30d)
- 1
Description
- Haxe version: 4.0.5
- Flixel version: latest
- OpenFL version: latest
- Lime version: latest
- Affected targets: Neko, Windows, HTML5...
Code snippet reproducing the issue:
PlayState.hx
import flixel.FlxSubState;
import flixel.FlxG;
import flixel.FlxState;
class PlayState extends FlxState
{
override public function create():Void
{
super.create();
}
override public function update(elapsed:Float):Void
{
super.update(elapsed);
if (FlxG.keys.anyJustPressed([ENTER]) || (FlxG.gamepads.lastActive != null && FlxG.gamepads.lastActive.justPressed.START)) {
openSubState(new PauseSubState());
}
}
}
class PauseSubState extends FlxSubState
{
override public function create():Void
{
super.create();
openCallback = () -> trace("ENTERING PAUSE STATE");
closeCallback = () -> trace("EXITING PAUSE STATE");
}
override public function update(elapsed:Float) {
super.update(elapsed);
if (FlxG.gamepads.lastActive.anyJustPressed([START])) trace("START BUTTON IS STILL PRESSED");
if (FlxG.keys.anyJustPressed([ENTER]) || (FlxG.gamepads.lastActive != null && FlxG.gamepads.lastActive.justPressed.START)) {
close();
}
}
}
Observed behavior:
GamePads input is not reset when entering substate
Expected behavior:
GamePad input should be reset, so it would not trigger substate close.
Keyboard works as expected.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the PlayState.hx reproduction and trace gamepad input handling when FlxState opens PauseSubState. Run the example on an affected target and compare the transition with keyboard input. Done means pressing START to enter the pause substate does not immediately trigger its close condition, while keyboard behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100