How do I Create Special Gems in a Match 3 Game?

0 favourites
  • 1 posts
From the Asset Store
A collection of various soldier character sprites for creating a 2D platformer or sidescroller game
  • Hi everyone :)

    This is the first time I post so please forgive any mistakes regarding forum rules and whatnot.

    I'm making a match 3 game (bejeweled, candy crush). I'm not using arrays for the whole grid, just to store the positions of the gems I'm trying to swap. the system works mostly fine, but I do have a problem I cant solve.

    When 4 or more gems are matched together, they create a supergem. The way im going about this is just looking at the color of the match, spawning a new Gem with the same color and another variable called super gem.

    The problem I'm having is that I cannot find the way to spawn it in the proper position:

    - If the 4 gem match is a direct result of my swapping, it creates the superGem in that spot, which is perfect.

    - If the 4 gem match is a result of the gems falling into the empty spaces created by other gems being destroyed, it picks the position of the last gem that got destroyed.

    - Gem ------ On destroyed / set,0) to gem.x

    Set to Gem.y

    The problem with the second option is that i cannot determine which gem will be destroyed last, and so, the supergem is always created at either end of the match.

    My question is, is there any way of picking the gem position closest to the center of the match to create the super gem there?

    Could you guys and girls have any suggestions about how to make this work?

    Thanks very much in advance


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