Get objects in range

Hi,

i’m actually trying to develop a simple tower defense. Atm, my tower game object shoots a fireball to every enemy in collision with it (so just one time). Instead i would like it to shoot a fireball to every enemy if it is in range, what is the best way to achieve this ? I’m totally new to game developpement so i’m a bit lost.

Edit : i would like to know what is the best way to time tower shots (like 1 per second for example) ?

Thanks

There are several ways. Probably the easiest is to use a trigger collision object and fire at any enemy that is inside the shape. You get messages on enter and exit. Check out http://www.defold.com/ref/collision-object#trigger_response

2 Likes

Yes, I’d use a trigger object for this. It seems like the most straightforward and easy to implement solution.

1 Like