Keeping track of the X position of many prototypes

I have an actor called platform. I have added several copies of it into the scene. The platforms are continuously moving horizontally. Setting a game attribute to keep track of the X position of the platforms will only keep track of ONE platform(obviously). What I want is to keep track of them separately without having to use separate game attributes for each platform prototype added into the scene. Is there a more elegant solution for this?

Best Answer

Answers

  • gayanjgayanj Member Posts: 10
    Wow this is awesome! I never knew tables could be used like this. In this way can I store any other attribute specific to the particular platform. Like if I want to have a boolean attribute to check if "isGrounded" is false for that platform and change it when an actor collides with it?
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Right. It really comes in handy when you can check table values to table values in rules. Table to table expressions, that is.
  • gayanjgayanj Member Posts: 10
    edited December 2013
    Wow I just played around with tables changing attributes. They are very powerful indeed. You just took my gamesalad development to the next level! ^:)^
    Thank you so much!
  • ktortiktorti Member Posts: 27

    So, I'm working on something that has this problem as well... did you ever figure out a solution? I downloaded the demo, but I'm not sure how to fix it so that my actor can be constrained to each individual platform whenever he lands on them

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2014

    If you are spawning many actors and want to sync them to a table row that holds their X position, this is what you do:

    Spawner actor:
    Change attribute game.spawnRow (integer) to game.spawnRow+1
    Spawn actor [actor name]

    Spawned actor:
    Change attribute self.myRow (integer) to game.spawnRow

    Then, when you need to store or retrieve that spawned actor's data, use self.myRow as the row value in a tableCellValue or other table behavior.

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

  • ktortiktorti Member Posts: 27

    Awesome, that helps a lot. I have three different platforms that spawn from one spawner so I'm guessing each of them would get their own cell in the spreadsheet? or another spreadsheet? Also, how would I make it so that the actor which jumps on those platforms is colliding with each specific platform? If that makes sense.

Sign In or Register to comment.