How do I shuffle my stones?

0 favourites
  • 4 posts
From the Asset Store
Simple but fun word game. Restore an original word from shuffled letters.
  • 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.

  • The stones are only an unique object with multiples instances, each one with an animation frame?

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)