How to shuffle the letters?

krazziebone02

  • Posts: 113
In the picture that I post i have 11 letters there and when i click the image with scissors all the letters will shuffle is it possible?? i dont know where will i start the codes
i want to be the best user of stencyl

letmethink

  • *
  • Posts: 2545
Assign each of the positions a value. Assign all of the actors a value. Create two lists and starting from the left hand side assign the values together e.g. 1-4 2-6 3-1 etc.

Then slide the tiles to the position their new index is.
~Letmethink

Innes

  • *
  • Posts: 1961
This requires the same skills as your question about selecting random items from a list. I'm sure there are many ways to do this, but here's one suggestion:

Setup:
1) Create a list
2) Add each of the letter actors to the list

To shuffle:
[Repeat] loop for number of items in the list
    Select random item (actor) from list
    Move actor to first position
    Delete the actor from the list, so it can't be chosen again
[end of loop]

Tip:
To place the actors, inside the loop, move each actor to (e.g.) X = 100 + (item number * 40). Make the Y a fixed number such as 300.
This will move the first actor to 100, 300 the second actor to 140, 300, the third to 180, 300 - etc.

Before you start, break the problem down into steps. For example. Work out how to add actors to a list. Then work out how to create a repeat that will loop for each item in the list.
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

krazziebone02

  • Posts: 113
This requires the same skills as your question about selecting random items from a list. I'm sure there are many ways to do this, but here's one suggestion:

Setup:
1) Create a list
2) Add each of the letter actors to the list

To shuffle:
[Repeat] loop for number of items in the list
    Select random item (actor) from list
    Move actor to first position
    Delete the actor from the list, so it can't be chosen again
[end of loop]

Tip:
To place the actors, inside the loop, move each actor to (e.g.) X = 100 + (item number * 40). Make the Y a fixed number such as 300.
This will move the first actor to 100, 300 the second actor to 140, 300, the third to 180, 300 - etc.

Before you start, break the problem down into steps. For example. Work out how to add actors to a list. Then work out how to create a repeat that will loop for each item in the list.

sir all i want is to shuffle the letters not to remove is it possible sir/?
i want to be the best user of stencyl

letmethink

  • *
  • Posts: 2545
What Innes described is shuffling the letters.
~Letmethink

krazziebone02

  • Posts: 113
What Innes described is shuffling the letters.

ohhh i see sir but i can't understands how to set the tips of innes
i want to be the best user of stencyl