Code Loop

CFourCFour Member Posts: 5
edited November -1 in Working with GS (Mac)
Hi I'm a new user with GS and I've been trying to find a way to create a grid of actors through a loop like command, does anyone have any ideas? The "Replicate" command is not suitable since the actor may vary (different tiles). Any help would be appreciated.

Comments

  • hotMagichotMagic Member, PRO Posts: 266
    Are you basically trying to do the equivalent of crawling across a grid and dropping, for example, 1 or 4 possible entity types in each cell, then doing the next row, etc etc until the grid is auto-generated?

    Some specifics like that would help. Like are you trying to control the frequency certain actors appear in the grid, or is it random? Are you populating a level this way?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I have a "for" loop demo on my wall that you are welcome to dig through.

    It's just a demo though, actually creating a grid-based game in GameSalad would be an experiment in torture without a proper Array or Table - and a way to loop through it.
  • CFourCFour Member Posts: 5
    I am trying to make a minesweeper game and need to place tiles in a grid which can vary in size. This is why I am trying to create a loop, any ideas?
  • hotMagichotMagic Member, PRO Posts: 266
    This is just a hunch of where I'd start:

    Draw your grid on some paper and basically define the positions of each place in the grid. Then make Game level attributes for each. We're talking about a whole bunch. like 1x, 1Y, 2x, 2y, etc. so you have a grid that's like this
    1 2 3
    4 5 6
    and so on.

    Make a manager actor. Do a loop for the total amount of positions. At each loop, it has to check which position you are on and reference that position. Then do a random for your total amount of types of tiles. have a rule that says if type ==1 spawn type 1, etc.

    that's how I'd start my line of thinking. But to actually make this all playable would be scary. Also, these type of games usually have some sort of process that makes sure that tiles are spawned in such a way that you have a possible move, right? That part is tough in GS.
  • calvin9403calvin9403 Member Posts: 3,186
    firemaplegames said:
    I have a "for" loop demo on my wall that you are welcome to dig through.

    It's just a demo though, actually creating a grid-based game in GameSalad would be an experiment in torture without a proper Array or Table - and a way to loop through it.

    for is really useful
Sign In or Register to comment.