0
Z odpowiedzią

Show 1 random element at the time in a group

Anita Sølver 6 lat temu w By Screen / Design Ostatnio zmodyfikowane przez Inna Komarovsky 5 lat temu 19
If I have 10 elements in the same group, how will I be able to show one or two random elements at the time, and only show the next, when the first have been hidden by a user action? Every elements may only be used once. 

And how will I move one, when all have been used?

Odpowiedź

Odpowiedź
W trakcie analizy
There is no special feature on how to select a specific element from the group. Could you give us in more details what  you want to do so we can find a way to do it?
Odpowiedź
W trakcie analizy
There is no special feature on how to select a specific element from the group. Could you give us in more details what  you want to do so we can find a way to do it?
It's still for the same thing; A match game.

I will make an illustration, and have objects on top - hidden in plain sight, that the user can find and click on.

To know which objects to find, they'll be provided with a textbox with a word in it. It could be hat, butterfly, red flower, squirrel and so on.

I want to show these words one at the time, or perhaps 2 or 3 side by side.
When the user finds one of the objects and clicks it, the object will be hidden and so will the word. The next word will then be shown.

Should it be more advanced I'd make 30 different words/objects, and only use 10 random words in each gameplay. But the way to do it, would be the same, I presume?

I could perhaps just stack the words, and when one is hidden, the next will be shown, but I'd like to be able to have a clean background for a moment in between the words, if possible. If not, I'll just stack them.

But I think the other way would be the best, and could be used for quizzes and other games too.

I'll take the quiz thought:
If I would make a quiz with 500 questions, and let the user play a game, where only 10 of these questions should be used. How would I do that? It's the same thing, really.

Or perhaps you have a better solution, that I haven't thought of yet? I am not totally familar with all behaviours yet, so if I'm going the wrong way, I would love to be pointed in the right direction :)
If I understood I think you can so this with Shuffle random group. So one group will be the objects, and one group will be the text elements. You will need two shuffle random group behavior invoked on page load for both of groups. If you have for example 10 words, you can leave only one of them on screen and place the other ones outside the screen. So you never know which word will be displayed on screen. Every object will have three behaviors: Hide self, Hide the text and two shuffle random group so it will shuffle the objects/text elements again.

And this way you can do with the questions to: leave only 10 of them inside the screen and the rest of 490 outside the screen. All the questions will be in the same group so when it will shuffle randomly you will never know which questions will apear on the screen.
I'm trying to figure out how to do this, and figured I'd start with 2 sets, since that should be enough to establish a workflow.

So I have 2 pairs. A tree and a cloud, and matching words.
To test the basics, I made words visible at page load, and to hide both image and text when tapped. It worked on both.

Then I made a timer and a button to start the timer with.
That works too.

To combine, I now tried to hide the words at pageload, and only to show when the timer starts up. And only one words shows up! What gives?

I have copied the text field and changed the name in properties, and changed the text, and only the copy shows up at party time. *sobs*

Props and action sets look like this:










Think it's time for bed. Perhaps my brain will see it more clearly tomorrow :P

In this case, the objects should always be in the same place, but the words should be random. The part with random words is fine with the shuffle function. 

But if I have 30 words/objects, and only want to use 10 in one gameplay, I don't see how that would work, besides stacking 10 on screen. But with the stacking technique, it would not work well to show 2 or 3 words at the time.

If there was a way to load the next word in the same spot, when one is hidden, that would open up for a lot of game activities. In this case, I would perhaps place 3 words side by side. If the user finds the object from a word shown at place 1, then a new word will show up there. And perhaps they find 7 objects from place 1 words, before they find the words from place 2 and 3.  If they were stacked, it couldn't happen this way. 

When the game loads, show random word in place 1, 2 and 3. If a word is matched with the right image, then hide the pair, and show a new word in the same place. Every word can only be shown once, and maximum 10 words must be used during a game. 

If an element in a group is hidden, then it's not possible for it to show up again in the same game, right?
You can use the swap behavior to change a text element with another text element by swaping positions.
Oh, cool. That could be a solution. I'll give it a try :)
But check my last comment, to see how this would not solve my problem with the match game ;)

I like to keep your creative thinking sharp and on the edge, don't you think?
If we take the 490 outside the screen and 10 on screen, how will the page know when the game is over?
By using a counter. So if you want only 10 correct answers then every correct answer will add 1 to a counter. When the counter value hits 10 then the game ends.
Okay, that would work, I think.

In fact, I would like to use the non-existing  functionality for the memory game too. I'm not a fan of the fade in/out thing. It works, but it's not practical and not so pretty.

I have tried to just unmask when a card is clicked, and let it stay that way, until the next card is tapped. If they don't match, I want them to mask right away when a third card is clicked. If it's a match, they'll go to a stack in the corner with the move animation.

I was trying to use the counter, to make it work like I imagined, but no luck so far. I can unmask and count that I've tapped x amount of cards. I can also re-mask when the counter hits two, and animate them to a stack in the corner if there's a match.. But when I tried to figure out how to reset the counter after the re-masking or match, I was lost.

If there was a way to tell that maximum two cards from the group could be shown at the time, then I could do it like I wanted to.  
To reset the counter you have to use the Reset Counter behavior, and it make the counter value to 0.
So I can make an action set like this?

Interaction: none
Behavior: reset counter (or something like that)
Target: my countername
Condition: Page counter is 2


I'll try that. Thanks :)
Alright.. tried it, and (as you may have feared), I couldn't make it work.
The counter does not reset. I have tried on the counter itself too, but that didn't work either. Should it be on both?

Here are my action sets:






















About that swap behaviour, that you mentioned here: where is it? 

I read all the documentation yesterday, and couldn't remember anything about that, so I searched the documentation site, but it came up empty. 

Is it a new feature, or just hidden well?

(I couldn't reply to the comment directly like I wanted to, because the little hover menu with the links to edit/reply doesn't work on iPad.)
The SWAP behavior is right under the Movement category of behaviors.
Ah! Thanks. I see it :D