How do I check if the player win this puzzle

  • I found a nice tutorial about a slide puzzle :

    The problem is that I don't know how to check if the player build the puzzle correctly to give you a award. Could someone please help me to figure out how to reward the winner? <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • Hey Braus!

    The easiest way, considering how it is implemented in this tutorial, would be to create an instance variable (text) for the Grid object called "position" and give it a value equal to the correct letter/piece for that position. So, first Grid on top row would be A, the second B, the third C, etc. Last grid is empty, so its position variable would be blank.

    Then, every time you reposition a piece (on the click event) you would call fuction similar to this one:

    EDIT: Here's a capx, so it's more clear.

    https://www.dropbox.com/s/r8rnbl1128oa9 ... .capx?dl=0

    I didn't implement the whole game, just the victory condition. Just drag all letters to the grid objects in the correct order. If you want to test, drop one letter on the last grid, which should be empty, put all others on their correct positions and then drag the last one to the right place.

  • Hi Bruno. Always saving me.

    Very nice solution. I will implement it.

    Many thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Glad to help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)