How do I arrange sprite in horizontal order and randomize

Get help using Construct 2

Post » Wed Feb 22, 2017 1:17 pm

Hello friends,

I am making a quiz game. I am stuck in middle of the project and I'm looking for some help.

I have 4 sprites, I finding a way to get it arranged in a horizontal order. Also, their order (position) should be different every time the layout starts (random every time the layout starts). Please see the image below:

Image

Once that is solved, I'm finding a way to do this:
Say there is a question and I have 4 answers which are all images. When the user click the image with his mouse, If the answer is correct, the sprite moves to the top position (animate the movement) and replaces the one which was there. The worng answer which was on the first position moves down to the empty space of the correct answer.

Thank you very much in advance. Really appreciate if I can find any help with either of the above issues.
B
6
S
1
Posts: 12
Reputation: 426

Post » Wed Feb 22, 2017 11:54 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Feb 23, 2017 7:36 am

Thanks for working this out friend :)
Hard to understand for me though.
Not from programming background but still, thanks for helping me out :)

Any other ways to do this maybe?
B
6
S
1
Posts: 12
Reputation: 426

Post » Thu Feb 23, 2017 9:09 am

I dont know if you have your 'questions & answer' system up and ready. I suppose not.
If you do, share your capx, and i will take a look.

Since you did not share a 'questions & answer' system, i had to invent a little sorta kinda trivia system to show the 2 things you asked for in a quiz environment. Randomize answers & change answers from position.

So most of the code is about the 'trivia'.

Again, i dont know if you have the 'trivia' part up and running.
This might be a good start:
https://www.youtube.com/watch?v=dPKhEOU2DFY

And those 2 tuts.
https://www.scirra.com/tutorials/1418/trivia-game
https://www.scirra.com/tutorials/1417/r ... ays/page-2
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Feb 23, 2017 11:22 am

Here is a tutorial on getting random numbers without repeats:

https://www.scirra.com/tutorials/315/generating-random-numbers-without-duplicates/revisions/2089

You can use that to get a random sequence of numbers for your color of sprites and also for arranging the sprites on screen without repeating the pattern.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790


Return to How do I....?

Who is online

Users browsing this forum: Euduardo and 24 guests