Constraining an actor to a table
jmachado999
Member Posts: 52
Here's the setup
I have a tower game that uses a table for towers and a table for enemies
How can I constrain a id of sorts so that I can access the actors attributes via the table. I want to use table row value when added but when an actor is destroyed and the rows shift the row numbers all change
How can I change all of the ids when an actor is destroyed , or is there another way to do this that I am overlooking?
These enemies are all spawned, so if the answer is row labels then is there a way to change the label names dynamically and also call them from the actor?
Thanks in advance for any help you can provide!
I have a tower game that uses a table for towers and a table for enemies
How can I constrain a id of sorts so that I can access the actors attributes via the table. I want to use table row value when added but when an actor is destroyed and the rows shift the row numbers all change
How can I change all of the ids when an actor is destroyed , or is there another way to do this that I am overlooking?
These enemies are all spawned, so if the answer is row labels then is there a way to change the label names dynamically and also call them from the actor?
Thanks in advance for any help you can provide!
Comments
http://forums.gamesalad.com/discussion/comment/383521/#Comment_383521
http://forums.gamesalad.com/discussion/comment/384027/#Comment_384027
The general idea is to increment a game attribute right before spawning an actor and then have the actor grab that game attribute and assign it to a self attribute. That self attribute then gets used throughout the game to change or check table row data (the attribute is the # of the row assigned to that actor).
I don't know if I've ever used that system to also remove an actor's row. One thought is just to blank out the row and not use it. But if you're also making use of the tableRowCount() function then you need to keep things neater than that. Honestly, I find it challenging to remove a row and keep everything synced.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I was sleeping on this and now I am thinking that maybe when the actor is destroyed I can pass the id of the destroyed actor back to the scene. After that check that value against the contents of the table and if any ids are greater than the value then -1 them. At the end of the loop change the value to row count or set another value to false.
I feel like there must be an easier way but I think that may work.
I like your idea of each actor checking a game idea to see if they are higher and subtracting one. I'll be curious to know if that works.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User