Looping over a table, think I doing it wrong.
This is my first time using loop over table so I am assuming I using the condition wrong.
I am building a tower defense game, I have the enemies constrain their position to a table(column1-x, column2-y)
Under the towers I used this code
Loop over Table:
Table: Enemies Cooridinates Rows
Start: first cell
Finish: Last Cell
Store attribute in: self.index
Do:
Rule:
If numeric expression: Magnitude(self.positionx-tablecellvalue(EnemiesCooridinates,self.index,1),(self.positiony.......)<150
Do:
Change attribute: Self.target to Self.Index
Ive checked the magitude, it calculates just fine. but when Magnititude<150 it doesnt change the target. So that being said I believe Im just using the loop over table wrong, can some confirm and or correct me?
Comments
Nevermind, I just used the ol fashioned homemade loop by adding a Index+1 in the otherwise and did away with the loop over table behavior. All set and working now!