You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is actually bug or design / usage mistake on my part. If it is not bug, please explain why it is happening.
I have two game states: PlayerTurn & EnemyTurn.
During GameState::PlayerTurn I run system for key input (writes event) and move player sprite according to that input (reads event). If there is any input (directional arrows), player action (movement) is done and I set GameState::EnemyTurn.
During GameState::EnemyTurn I run one system, that only moves enemy sprite left or right and then sets GameState::PlayerTurn. But next player turn there seem to be cached key input because even if I don't press any keys it reports key being pressed and window freezes.
What you expected to happen
After setting GameState::EnemyTurn I expect player systems to run as if no player key was pressed unless it is actually pressed.
What actually happened
After key is once pressed it seems it get stored / cached somewhere and after that system always behaves as if key was pressed although no key was pressed
May 17 22:05:25.336 INFO wanderer::systems::player: gs=State { transition: None, stack: [PlayerTurn], scheduled: None, end_next_loop: false }
May 17 22:05:25.336 INFO wanderer::systems::player: action=NoAction <--- No key yet pressed
May 17 22:05:25.336 INFO wanderer::systems::player: msg="player move or attack"
May 17 22:05:25.352 INFO wanderer::systems::player: gs=State { transition: None, stack: [PlayerTurn], scheduled: None, end_next_loop: false }
May 17 22:05:25.352 INFO wanderer::systems::player: msg="Up key pressed" <--- Actually presed key
May 17 22:05:25.352 INFO wanderer::systems::player: action=Movement(1, 2)
May 17 22:05:25.353 INFO wanderer::systems::player: msg="player move or attack"
May 17 22:05:25.353 INFO wanderer::systems::player: msg="moving player"
May 17 22:05:25.353 INFO wanderer::systems::player: msg="setting state to EnemyTurn" change_state=true
May 17 22:05:25.353 INFO wanderer::systems::player: msg="set state to EnemyTurn"
May 17 22:05:25.353 INFO wanderer::systems::enemy: msg="enemy move"
May 17 22:05:25.353 INFO wanderer::systems::enemy: gs=State { transition: None, stack: [EnemyTurn], scheduled: None, end_next_loop: false }
May 17 22:05:25.353 INFO wanderer::systems::enemy: msg="setting state to PlayerTurn" gs=State { transition: None, stack: [EnemyTurn], scheduled: None, end_next_loop: false }
May 17 22:05:25.353 INFO wanderer::systems::enemy: msg="set state to PlayerTurn"
May 17 22:05:25.354 INFO wanderer::systems::player: gs=State { transition: None, stack: [PlayerTurn], scheduled: None, end_next_loop: false }
May 17 22:05:25.354 INFO wanderer::systems::player: msg="Up key pressed" <----- Didn't press any key
May 17 22:05:25.354 INFO wanderer::systems::player: action=Movement(1, 3)
May 17 22:05:25.354 INFO wanderer::systems::player: msg="player move or attack"
May 17 22:05:25.354 INFO wanderer::systems::player: msg="moving player"
May 17 22:05:25.354 INFO wanderer::systems::player: msg="setting state to EnemyTurn" change_state=true
May 17 22:05:25.354 INFO wanderer::systems::player: msg="set state to EnemyTurn"
The text was updated successfully, but these errors were encountered:
According to description it seems to be the same issue, just a bit different use case. Stuff recommended in that bug helped me work-around this issue.
Thanks.
Bevy version
0.5
Operating system & version
Windows 10
What you did
Not sure if this is actually bug or design / usage mistake on my part. If it is not bug, please explain why it is happening.
I have two game states:
PlayerTurn
&EnemyTurn
.During
GameState::PlayerTurn
I run system for key input (writes event) and move player sprite according to that input (reads event). If there is any input (directional arrows), player action (movement) is done and I setGameState::EnemyTurn
.During
GameState::EnemyTurn
I run one system, that only moves enemy sprite left or right and then setsGameState::PlayerTurn
. But next player turn there seem to be cached key input because even if I don't press any keys it reports key being pressed and window freezes.What you expected to happen
After setting
GameState::EnemyTurn
I expect player systems to run as if no player key was pressed unless it is actually pressed.What actually happened
After key is once pressed it seems it get stored / cached somewhere and after that system always behaves as if key was pressed although no key was pressed
Additional information
Can be tested with https://github.com/vildapavlicek/wanderer/tree/state-bug
INFO: the game state that makes problems is called
TempGameState
as there is another one that I used before which is simple resource.The text was updated successfully, but these errors were encountered: