Having actor spawn other actors without overlapping

ExplosiveGamerExplosiveGamer Member Posts: 33
edited June 2014 in Working with GS (Mac)

Actors that are relevant for this event:

Button actor: if touch>pressed
Do spawn actor>Tower at hero x and hero y.
Hero actor: Is the player and is capable of being dragged.
Tower actor: Shoots bullets

Problem: I don't want the towers to be capable of overlapping each other at all.

What I have tried: Creating an empty table, that records the position of each tower spawned, however even if the hero is slightly away from that position it is able to spawn another tower. I don't like this happening because it does not look good, and I want the player to be able to direct where the tower shoots by selecting the individual tower without interrupting the others.

Any advice and approaches are welcomed.

Comments

  • ExplosiveGamerExplosiveGamer Member Posts: 33

    anyone...?

  • ArmellineArmelline Member, PRO Posts: 5,369

    There are a lot of variables that will affect how you approach this. Is your game grid based at all? How big is the tower in comparison to the player?

    You're probably going about it the best way with the table, but when working out if a tower is allowed to be spawned you need to take into account not just the position of the centre of the tower, but also the edges. If the tower is 50x50 pixels and located at x=100, y=100 you will have to be making sure the player isn't with an area spanning from x=75 to x=125 and y=75 to y=125.

Sign In or Register to comment.