Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Fix overlapping of actors, different method

Hero Actor- This is you. (Player) Position x and y are shared on game attributes as hero x & hero y.
Power up actor- This is a tower. Position x and y are shared on table. There is a limit of up to 3 towers.
Button Actor- when pressed spawn Power up actor at hero x & hero y BEING THAT hero x & hero y do not equal any of the power up's position values.

So with this i am able to spawn towers not in the exact position of another tower, however if the hero x's and hero y's position are even just slightly away from the position of another tower, another tower can be spawned and this results in a overlap. I want to make it so that Towers are not overlapping.

Here is what the code looks for in my button actor.
Background info on tower location table. (Each column represent a different tower, row 1 represents position x and row 2 represents position y)
Button actor

if Touch is pressed
if attribute
hero x != tablecellvalue (tower locations, 1,1)
hero y != tablecellvalue (tower locations, 2,1)
...I do this for all three colums
spawn actor Tower at hero x & hero y

Sign In or Register to comment.