memory quiz

  • hi, I want to make a memory quiz game with 500 levels .. is there any method to generate blocks automatic

    like in this image plz

  • I got bored and figuring this out was better than sudoku.

    twistedvoid.com/diamondtest

    download:

    twistedvoid.com/diamondtest/DiamondTest.c3p

    It uses one hexagonal sprite and placement is based on 2 for-loops. There's a number of variables used and I just set them to globals for expediency. The two you need to set are, startnumberofcolumns and startnumberofrows. The other thing you should play with is the sprite x and y scale. The online example duplicates the image you provided. However, playing with the 2 vars and the sprite size, you can do a bit more.

    And for those who'd just rather see the code here:

    *Got home and updated it to clean up the code (couldn't have the public thinking I do inefficient coding.) The download c3p now looks like the code above.

  • Thank you very much, I will try this

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Fengist

    I have 2 questions else :

    1- how I can align blocks center horizontal & vertical

    2-any methods to create random shapes like in image,,

  • If you study the code I wrote, you'll learn that it already centers horizontally using the viewport left and width. Centering vertically is done the same way. Creating different shapes is just a matter of playing with the math.

    Two ways that come to mind to make irregular shapes is 1. using unique formulas like I did for the one above or 2. predefine the layouts with arrays with 0's and 1's whereby the 1's indicate that a sprite should be created.

    But, you're planning on 500 levels which would be a LOT of arrays. What I would look at doing is writing a formula that randomly creates 1/4 of the array which would say, draw the top left quadrant. By reading the array back in different directions, you could draw the other 3 quadrants and they'd be symmetrical like the image you have above. The trick would be to consider the fact that the rows alternate in even and odd numbers of sprites.

    But, you have lots of other things to consider. If this is a typical memory match game where you match 2 images you'll have to figure out how to keep the layout to an even number. You'll have to figure out how you're going to display those sprites, how to 'match' them and how to get them to layout with the proper number of each using the same layout you did for the blue ones.

  • ok thank you very much

  • Just thought of another way this could be done. Fractals. It would take a good bit of tinkering to get a formula that you could use but, by changing parameters each iteration it could generate your layout.

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