Using tables to set up a scene

I think this is possible, I just want to ask for some help.

I have a table with 2 columns and 60 rows. Column 1 is an integer for X and Column 2 is an integer for Y. Each row has a different X and Y coordinate. I am trying to find out how can I call that table into a scene to place an actor at each of specified points.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2015

    You would use the Loop over Table behavior and place a Spawn Actor behavior inside of the loop and then use the loop counter attribute in the tableCellValue() expressions for the x and y positions in the Spawn Actor behavior.

    I modified a demo I made before that behavior was added to GameSalad. See attached.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • GamingtilDawnGamingtilDawn Member Posts: 104

    Thank you @tatiang for the response and demo.

    Tables are one thing that I just cant seem to completely understand in GS. I was looking at your demo and two things that are confusing me are:

    1. What is the need for the spawner and loop spawner?
    2. I originally did think of using the tablecellvalue() expression. However I didnt know what to place in "row". I see you made an actor attribute. What exactly does that do?

    My last question and sorry for so many. :) Does a destroy behavior on the actor that I am spawning effect my table in anyway? Example, if I destroy an actor will it appear right away (which i dont want) or will it know to wait until the game is reset?

Sign In or Register to comment.