Search Unity

coins pattern

Discussion in 'Scripting' started by mujee, Dec 25, 2013.

  1. mujee

    mujee

    Joined:
    Mar 9, 2012
    Posts:
    54
    hi,
    i want to spawn coin patterns like jet pack joyRide Game.

    could anyone Help me please.
     
  2. mujee

    mujee

    Joined:
    Mar 9, 2012
    Posts:
    54
    please help me
     
  3. Gale

    Gale

    Joined:
    Jun 22, 2012
    Posts:
    40
    Not everyone knows what you are talking about. Be specific with what you want. Also if you don't at least try to do it yourself people are less likely to help you. We are here to help we're not here to do your work for you
     
  4. jessee03

    jessee03

    Joined:
    Apr 27, 2011
    Posts:
    729
    What Gale said. No idea what that game is or how the mechanics work. Please explain clearly what you want to accomplish and we can help you out.
     
  5. MDragon

    MDragon

    Joined:
    Dec 26, 2013
    Posts:
    329
    Agreed to what was said before about the topic, but since I was also curious about the mechanics of this yesterday, I'll try to help out by describing this.

    Jetpack Joyride example
    (not the best example video, but the coins system is quite similar and related to the appearance of obstacles)

    To put it simply, this is a side scrolling game where you can move vertically to dodge obstacles, collect coins, and get power ups.

    While the environment moves, coins (and more often traps) show up in pre-defined patterns. These usually show up before/after a series of traps, and the placement of the pattern of coins differs vertically (as in how high up it is).

    Additionally, the different coin patterns also reflects if/what power-up is in use. So, the patterns of coins depends on the character at least somewhat.

    I hope I didn't miss anything important and thanks for helping to sate my curiosity, and of course helping out mujee :D
     
  6. mujee

    mujee

    Joined:
    Mar 9, 2012
    Posts:
    54
    thank you so for Reply. and sorry i cannot explain it clearly.

    i want to write a pattern in a Notepad. and read this file through Xml to draw a patteren. here is example

    $jetpack-1.jpg

    $jetpack-joyride-1.jpg

    $JetpackJoyrideScreen_06-940x626.jpg

    $photo-11.jpg


    thank you
     
  7. ahaykal

    ahaykal

    Joined:
    Apr 18, 2010
    Posts:
    117
    Basically what I would do is do the pattern manually and make them as a prefab. Then via code you can instantiate this prefab.
     
  8. mujee

    mujee

    Joined:
    Mar 9, 2012
    Posts:
    54
    @ ahaykal tanx for your reply.
    I already done like your way. but his is very lengthy process.
    read txt file through Xml and then draw a pattern is much better.
     
  9. Bongmo

    Bongmo

    Joined:
    Jan 18, 2014
    Posts:
    155
    Hi,

    that's looks like my question.
    http://forum.unity3d.com/threads/224022-Random-Array-Map

    I would use arrays.

    For example:

    Code (csharp):
    1.  
    2.  
    3. using System.Collections.Generic;
    4.  
    5. List <int[,]> pickups = new List<int[,]>();
    6.  
    7.  
    8.     int[,] pickups1 = new int[,] {
    9.         {1, 1, 1, 1, 1},
    10.         {1, 0, 0, 0, 1},
    11.         {1, 0, 0, 0, 1},
    12.         {1, 1, 1, 1, 1}
    13.         };
    14.  
    15.     int[,] pickups2 = new int[,] {
    16.         {1, 0, 1, 0, 1},
    17.         {0, 1, 0, 1, 0},
    18.         {1, 0, 1, 0, 1},
    19.         {0, 1, 0, 1, 0}
    20.         };
    21.  
    22.     //...
    23.  
    24.     pickups.Add(pickups1);
    25.     pickups.Add(pickups2);
    26.  
    27.     // then load the pickup pattern in another array
    28.     int[,] randomPickup = pickups[Random.RandomRange(0, pickups.Count)];
    29.  
    30.     //...
    31.  
    32.     for (int i = 0; i < randomPickup.GetLength(1); i++) {
    33.         //...
    34.     }
    35.  
    36.  
     
    Last edited: Jan 23, 2014