Is this ok method to create a user input 'password'?

Fire Fox

  • Posts: 8
My game has a hidden bonus part that requires the user to type in a code that they have found during the previous scene. I have mashed together one way of doing this, but wanted to see if anyone knew of a more memory efficient way?

My current technique consists of 5 scenes for the 5 letters of the code. Each scene consists of:

First layer with the same dark background that has the instructions to type in the code.

On top of that is a second layer holding an 'actor' of a keyboard, which redirects the user back to the main level screen when clicked on anywhere.

On the third and top layer is another 'actor' of a keyboard button that redirects the user to the next code scene. The button is placed exactly in line with the matching button on the keyboard below, so it blends in with the other buttons.

Assuming the user clicks on all the correct 'actor' buttons to form the code, they are directed by the last button 'actor' to the bonus scene.

Does this sound correct to everyone? I have no idea how any of the code stuff works,  but can draw well. So I'm currently just using carefully placed actors, backgrounds and scenes to make things happen! Am I on the right track? It seems to work fine when tested.

« Last Edit: December 16, 2014, 02:48:12 pm by Fire Fox »


  • *
  • Posts: 1632
Hello !

There's a few ways to do this
 - you could create a virtual keyboard, there's a tutotial on youtube made by sdieter on this
 - you could do what you are doing but using one scene.

You can place all you actors on the screen.
Have the actor value set as the name of your letter.
In the  actor behaviour, whenever an actor is clicked increment a game vallue ( or local value of the scene) by one.
(there you can use the text fonctions or the lists as you wish)
check if the character at character position of the timer is the same as your password text.
if it's not you change scene
if the counter = number of letters in your  password
goo to bonus scene.

But if you don't want to stop the player at the first mistake, but let him try type a whole password
(For example the password is "bad".
Here with thismethod , if he types "a" , the scene changes, so he knows it doesn't begin the letter a. He could guess the password like this. )
simply you could add the value of the letter to a  game text attribute passwordGuess.
if passwordGuess == password
go to bonus scene
if Length of passwordGuess  > length of password
go Back to the scene

Fire Fox

  • Posts: 8
Aaaah very clever! I'll go with the last option you posted. Thank you!  :D