Hiero Match : Add New Challenge “Shuffle Tiles”

Unity 3 Blueprints

Unity 3 Blueprints

Hiero Match is a Matching/pairing game ‘tutorial’  using unity3d from the book UNITY 3 BLUEPRINTS, written by Craig Stevenson and Simon Quig, and published by Deep Pixel. This tutorial start from chapter 2 and finished to chapter 3.

In this blog, I will show you how to add new challenge to the game. First things we want to add to a Matching/pairing games is shuffle the paired tiles/cards everytime we playing the game. First we would need complete game project files from the book, you can download it here.

 

Hiero Match

Hiero Match

//randomizeArray function is simplest way to shuffle array valueSo we could started to add new function called ‘RandomizeArray’ to our tileGenerator.js script. Here is the complete function of randomize array function :

//the basic idea was Fisher–Yates shuffle algorithm
//by exchanging value a[i] to a[random]

static function RandomizeArray(arr : Array)
{
    //iterate array backwards
    for (var i = arr.length - 1; i > 0; i--) {
        var r = Random.Range(0,i);
        var tmp = arr[i];
        arr[i] = arr[r];
        arr[r] = tmp;
    }
}

That’s all, other thing you need is to called “randomizeArray()” function at the top of the Start() function.

function Start () {
	Camera.main.transform.position = Vector3 (2.25, 2.25, -8);
   //place this line below on top of Instantiate Object
	RandomizeArray(this.tileLocations);
	for (var i=0; i < this.numberOfTiles; i++){
		Instantiate(this.tileObjects[i], this.tileLocations[i], Quaternion.identity);
	}
}

Now you can test it with play button on unity3D windows, and Voila, your tiles position has been randomized.
You can try the modified game here >>

and also checking our Hiero Match tutorial.
1. 2. Hiero Match : Adding Exploding Particles Whenever Tiles Removed
3. Hiero Match : Speeding Up The Timer Whenever Tiles didn’t Matched
4. Hiero Match : Adding Start Menu GUI
5. Hiero Match : Add New Challenge “Rotating Tiles”
6. Hiero Match : Polish Your Game a Little bit ‘Shine’

12 Opinion to this post

  1. Johng442 says:

    This is why Facebook games are becoming more popular. The ease of use and dissemination of content, tagging ddecddecedcc

  2. Dagny Kunze says:

    Would you go for a diaper bag with a shoulder strap or one in backpack design? A lot of the designs that are coming out in the market are in backpack design which is more convenient for any parent. With a backpack diaper bag, you have both hands free to take care of your baby and carry other stuff.`’

    Our web site
    <http://www.foodsupplementcenter.com/

  3. louis vuitton store says:

    Usually I don’t learn post on blogs, but I would like to say that this write-up very forced me to take a look at and do it! Your writing taste has been surprised me. Thank you, quite great post.
    louis vuitton store http://louisvuittonstores2013.overblog.com

  4. isabelle marant says:

    Dude.. I am not a great deal into analyzing, but somehow I managed to get to read many articles in your blog. Its impressive how interesting it truly is for me to visit you very often.

  5. […] 1. Heiro Match : Add New Challenge “Shuffle Tiles” 2. Heiro Match : Adding Exploding Particles Whenever Tiles Removed 3. Heiro Match : Speeding Up The Timer Whenever Tiles didn’t Matched 4. Heiro Match : Adding Start Menu GUI 5. Heiro Match : Add New Challenge “Rotating Tiles” 6. Heiro Match : Polish Your Game a Little bit ‘Shine’ : we will add a game music that’s play on every scene and we also will add some sound effect to your game.  Unity 3 Blueprints […]

  6. […] also checking our Hiero Match tutorial. 1. Heiro Match : Add New Challenge “Shuffle Tiles” 2. Heiro Match : Adding Exploding Particles Whenever Tiles Removed 3. Heiro Match : Speeding Up […]

  7. […] also checking our Hiero Match tutorial. 1. Heiro Match : Add New Challenge “Shuffle Tiles” 2. Heiro Match : Adding Exploding Particles Whenever Tiles Removed 3. Heiro Match : Speeding Up […]

  8. Eudora says:

    I discovered your blog using google. I must I am floored by your blog. Keep up the good work.

  9. […] also checking our Hiero Match tutorial. 1. Heiro Match : Add New Challenge “Shuffle Tiles” 2. Heiro Match : Adding Exploding Particles Whenever Tiles Removed 3. Heiro Match : Speeding Up […]

  10. GUCCI BELT BAGS OUTLET says:

    I can’t believe this Finest gucci boots on sale gucci diaper bag reviews! when i already have Three or more twos of upright,3 little and a pair of house!3 Concerning an item for each day and i also just simply will not secure enough! attractive but complicated. <33333333333333 true love!

  11. […] also checking our Hiero Match tutorial. 1. Heiro Match : Add New Challenge “Shuffle Tiles” 2. Heiro Match : Adding Exploding Particles Whenever Tiles Removed […]

  12. seo tools says:

    I truly appreciate this post. I have been looking all over for this! Thank goodness I found it on Bing. You have made my day! Thanks again

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.