Yes I have a problem on that three parts and last would be the result scene (consistent as the last scene to be shown ). I may either have a problem where to put and what code needed to be typed
Each of those parts is going to take some investigation and education on your part to achieve. I can guarantee that questions relating to each of those parts have been asked (and answered) in the Corona forums here. I already put up a link for scene randomization, which should give you a pretty good starting point.
It’s important for you to separate each of these parts, so that you can confirm that the first part works outside of the scene management logic. Then, you want to confirm that your scenes work without your “randomized progression” logic. Then you can put the first two parts together to achieve the third part.
If i used this code:
- for i=1, 3 do
- postable[i]=i
- end
- local function shuffle(t)
- local iterations = #t
- local j
- for i = iterations,2, -1 do
- j = math.random(i)
- t[i], t[j] = t[j], t[i]
- end
- end
- shuffle(postable)
- for i = 1 , (#postable) do
- print(postable[i] )
- end
how can i go to random scenes? do i need to put all the scenes in one lua script? how can I go to result scene which always be at the last?
It is working on terminal but the questions are still not answered. I am thinking of getting the indexes of each array but dont know what the code is something like this if possible:
TERMINAL:
3
2
1
CODE:
composer.gotoScene(array name[1], “animation”, “delay”);
Thanks for the help of those who post and answered the question xDDD
Here’s an update when I create a prototype of the array_shuffle and combines the built in sample program of composer module it works but only on the first scene the other scenes are not:
Flow:
1st attempt = 2,3,4,1
2nd attempt = 1,2,3,4
3rd attempt = 4,1,2,3
4th attempt = 3,4,1,2
as you observed only the first scene do randomizing the others are just sequentially display. I need the other scenes shuffle also
Terminal:
4
3
1
2
Expected flow:
1st attempt = 4,3,1,2, result
when the button is press and showing the last page as result
suggestions and/or a helping hand will be great appreciated =)