I’m trying to figure out how to check if spawn point is empty, so I can spawn new entity there. Still not sure how to do it.
For example:
First step
I have 3 spawn points.
function init(self)
local n = self.maxPoints
local spawnPoints = {}
for i = 0, n-1 do
spawnPoints[i] = go.get_world_position("spawnpoint" .. i .. "")
end
end
Second step
If I want to spawn a new entity, I pick one and spawn it.
Yeah, that’s what I’m trying to do. My spawnpoints are invisible GOs with a collision. Questions is how can I check collisions between SP and entity before I actually spawn an entity?
Or maybe I misunderstand something?
Create a GameObject “SpawnPoint” that has a collision with the GameObject “Entity”. On each update, check if SpawnPoint has a collision with Entity, if there is no collision, spawn a new Entity at the position of SpawnPoint.