Moving dynamic Actors together?
MagicShap
Member Posts: 1
I am writing a TD game, and I need to constrain each radius to it's corresponding tower. I'd like to avoid global attributes, since I'd like players to be able to create as many towers as they can afford in long levels. How do I constrain a dynamically created tower's radius object to the tower object's position?
I am using a table to hold the tower's attributes ( damage, image, radius size, etc..) and thought "let's constrain a table cell to the tower position" but that is apparently impossible. Any pointers?
I am using a table to hold the tower's attributes ( damage, image, radius size, etc..) and thought "let's constrain a table cell to the tower position" but that is apparently impossible. Any pointers?
Best Answer
-
tatiang Posts: 11,949That's how I did it for this demo: http://forums.gamesalad.com/discussion/comment/384027/#Comment_384027
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
Alternatively, you could use:
when
ANY
self.position.X does not equal tablecellvalue(yerTable, yerRow, yerColumnFerX)
self.position.Y does not equal tablecellvalue(yerTable, yerRow, yerColumnFerY)
Change TABLE VALUE behavior:
Table =yerTable
Row = yerRow
Col = yerColumnFerX to Value = self.position.X
Col = yerColumnFerY to Value = self.position.Y
if you have alot of stuff going on, you could also add a boolean as a game attribute, and flip this to true when the X&Y attributes don't match the table.
Then make another actor watch this boolean, if its true, immediately flip it to false, and update all the info in the table and any related actors. It can get pretty complicated, but dont be afraid to add the game attributes you need.
If they are avoidable... ya know, avoid em, but sometimes they just arent...
I'm planning on having a 'tower_index" and "enemy_index" so the radius can tell the tower to shoot the right one.
If there's a better way...
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User