Hi, I am very new to defold. I am working on the war tuorial and stuck at a spot.
I am creating tanks at random location. Now i need the tanks to move towards the player. Can someone help me out with this.
function spawn_tank(self, dt)
self.timer = self.timer - dt
if self.timer <= 0 then
self.timer = 2
id = factory.create("#tankfactory", vmath.vector3(math.random(100,500), math.random(100,500), 0))
end
end
I can get the player position using go.get_position("player"). But can’t figure out how to get all the spawned tanks to the player after a short delay. I tried set_position but couldn’t manage to get it to work.
Hey @Alex_8BitSkull Thank you very much works like a charm . In my case the payer position comes something like (x,y,1) when I give this in animate tank is not show. I have to give it as (x,y,0) (I might have changed something somewhere).
Next i will start working on moving tank again once it stops so it doesn’t stay at a place for long.
Again tvm for the quick response.