Search Unity

coding in game tiles

Discussion in '2D' started by Cool-Hand, Aug 17, 2019.

  1. Cool-Hand

    Cool-Hand

    Joined:
    Dec 9, 2017
    Posts:
    1
    Let me start of by saying that I am new to unity and a novice to coding in general.

    My question I have is if there is a way to make a script that would generate tiles to form a game board that formed a design?

    As an example lets say I am using two color tiles (yellow and white) and i want to generate a game board that is 10 by 10 tiles that is a white background with a yellow star design in the middle.

    Looking for a nudge the right direction to figure out if/how to code something like that.

    Thanks in advance for the help.
     
  2. A_Person_Named_Dart

    A_Person_Named_Dart

    Joined:
    Apr 14, 2018
    Posts:
    330
    For something like that you would probably want a position to create tiles, and a tile to create. Instantiate the tile, and then move the "position to create tiles" forward. If it reaches the end, move it down by the y axis and back to the start on x axis. Repeat this until it fills all the tiles with something like a for loop.