Hey guys, could someone check my logic - I have no idea why it's not working!
+ System: On start of layout -> mobiPath: Spawn deathBullet on layer 0 (image point 1) -> deathBullet: Set angle toward (mobiPath.ImagePointX(2), mobiPath.ImagePointY(2)) ----+ deathBullet: Bullet distance travelled = mobiPath.Width -----> deathBullet: Destroy[/code:wbxm5uy9] I'm trying to make a spawner create an object that will travel the distance of its parent before being destroyed - but the above code doesn't work Any insights would be greatly appreciated
I managed to get a workaround with the following:
+ System: On start of layout -> mobiPath: Spawn deathBullet on layer 0 (image point 1) -> deathBullet: Set angle toward (mobiPath.ImagePointX(2), mobiPath.ImagePointY(2)) -> deathBullet: Set distance to mobiPath.Width + deathBullet: Bullet distance travelled = deathBullet.distance -> deathBullet: Destroy [/code:1dd5rjdu] I still have no idea why the first example didn't work - in my head they do the same thing
Develop games in your browser. Powerful, performant & highly capable.
The first example didn't work, because On Start of Layout the bullet is not even created yet, and of course hasn't traveled any distance.
So the way you fixed that was absolutely correct.