Random letters with password ones

Hey Marcin,

Because you’re choosing letters randomly for each text, some letters wouldn’t be chosen at all, even the ones required for the password.

I’ll give you a solution that does this dynamically, and you can build upon it.

Let’s say you have a level where the password is “DOOR”.

Declare these variables:

Event:

The event runs like this:

  1. Repeat 4 times (number of characters in the password, in this case it’s 4, stored in the variable “Length”), extracting each letter from the password and adding them as children to the array “Letters”.
  2. Repeat 16 times (20 - 4) and add random letters to the array.
  3. Shuffle the array so that the password is not in the first 4 letters (Install the ArrayTools extension to get this action)
  4. Repeat for each text object and set them to the children of the “Letters” array.

So for each level you’ll only need to change the “Password” variable and the rest is done automatically.

Edit: I saw your other topic and I didn’t notice you changed the event in this screenshot. The solution I shared does this automatically so you don’t have to do do this manually for every level.

1 Like