Keeping track of the X position of many prototypes
gayanj
Member Posts: 10
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
-
Braydon_SFX Posts: 9,273You can use Tables. Try something like this.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Answers
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Thank you so much!
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
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
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.