Help regarding enemy

Through research, tinkering and the help of a really nice defold forum user, @rama , I have implemented an enemy spawning system.

However, I really don’t think the way I am spawning the enemies is efficient. I basically randomise a game object to spawn to, and spawn it accordingly. Here is the layout of the game object spawns:

image

The code works fine, it’s really good (once again, thank you rama!), however there must be a better way to get positions? Do I need game objects?

Hi there :wink:

If i understand you correctly, you randomly choose one of these 6 spawn points and get it’s position to spawn the current enemy to?
Then i think this solution is absolutely fine and efficient if you just want these 6 fixed points in your level.

1 Like

Yes, correct. Is having game objects inside a game object efficient?

Have you thought about factory.create to dynamically create your enemies? You could create as many enemies as you want when you want.

1 Like

Yes it is. Gameobjects themselves are very very cheap, they are basically just folders in this regard.

2 Likes