hello, guys! got bug or just another problem. my factories work strange. first 2 go spawning without scaling. than 15 (or something like that) spawning without any mistakes and then factory creates 2 more and these go do not move (but they have to). is there any limits for go and how to fix spawn without scaling or/and moving etc?
code:
function update(self, dt)
if self.spawn_interval<=0 then
factory.create("#factory", vmath.vector3(100, 600, 1),go.set_scale(0.08))
factory.create("#factory", vmath.vector3(1000, 600, 1),go.set_scale(0.08))
self.spawn_interval=2
end
self.spawn_interval=self.spawn_interval-dt
end
What you’re doing here is to change the scale of the game object your script is attached to, not the scale of the game object you are about to create. Here are two different ways of doing it:
-- option 1) send the scale to the factory to scale the game object when it is created.
--- this is the preferred way of doing it
factory.create("#factory", vmath.vector3(100, 600, 1), 0.08)
-- option 2) create the object, then change the scale using the object id
local id = factory.create("#factory", vmath.vector3(100, 600, 1))
go.set_scale(0.08, id)