How do I shuffle my stones?

Get help using Construct 2

Post » Wed Mar 04, 2015 3:18 am

Hello you creative minds, artists and developers!

First of all: I am a total beginner. So please excuse some stupid questions i will ask. Some day I will have learned enough to help other newbies, just like you are about to do (hopeflly).

So i've created a simple Mahjong game to get a better understanding for construct. It only has one layer, so there are only the x- and y-coordinates. Everything works fine except the shuffle function. Every stone has an animation (the picture of one of the mahjong stones) depending on it's uid. My problem is, that i don't get how to change the order of this animations randomly every time I start the game.

So, if there is anyone out there who can help me with this (i'm sure it is) silly problem, I would be very thankful.
B
3
Posts: 7
Reputation: 189

Post » Wed Mar 04, 2015 4:51 am

The stones are only an unique object with multiples instances, each one with an animation frame?
Image
B
15
S
7
Posts: 126
Reputation: 1,865

Post » Wed Mar 04, 2015 6:34 am

Most basic way would be to create variabe, give it random rounded number (from 1 to max number of combinations) and then for each combination IF condition like:
if var = 1 - do 1st combination
else
if var = 2 - do 2nd combination
and so on.

Of course, there are probably more advanced and elegant way, like using a family (when you create family construct spawn random member), but sometimes most basic things are the best. ;)

Can you give us capx?
B
12
S
6
G
2
Posts: 99
Reputation: 1,727



Return to How do I....?

Who is online

Users browsing this forum: krombanna, SneakyHands and 5 guests