How to create random button prompts

You need punctuation, desperately; almost run out of breath reading that run-on sentence :wink:

What you’re asking for is somewhat involved, I’ll just outline what’s needed briefly.

For the widget:

  • create a widget with the prompt - a text box showing which button to press will do
  • override onKeyDown and check what button is being pressed
  • make a list with the correct key sequence, an array perhaps or a Map
  • once the correct key has been pressed, step to the next element in the array
  • once the last key in the sequence has been correctly activated, have the widget send a notification to whatever needs to act next
  • if any of the sequence steps fails, have the widget communicate that as well
  • switch back to Game and UI mode (see below)
  • remove the widget from the parent, destroying it

For the trigger:

  • onBeginOverlap create the widget
  • add it to the screen and set position in the viewport
  • switch to UI only and set the focus to the widget created above (this way the player cannot do anything else but mash buttons)