Trouv / willos-graveyard

Sokoban puzzle game made for GMTK 2021 game jam - Joined Together
3 stars 0 forks source link

feat: add button prompt plugin #117

Closed Trouv closed 1 year ago

Trouv commented 1 year ago

Closes #114

This adds a simple button prompt plugin which spawns button prompts on UI buttons whose action can also be triggered by a physical button. More technically, it spawns button prompts as children of entities that have a UiAction<A>, where A is an Actionlike, and Res<InputMap<A>> exists. Currently this only works for single-keyboard input.

This also fixes an issue with the IconButtonPlugin. It despawned all of its children on change detection so it could respawn them, whether or not these children were icon button elements. Button prompts got caught in the crossfire. So, it has been changed to only despawn icon button elements change detection, and similarly the button prompt plugin only despawns the button prompt entity.

Tests have been added for the core functionality, change detection, and the bug fix described above.