This site requires JavaScript, please enable it in your browser!
Greenfoot back
HugoTroop
HugoTroop wrote ...

2017/12/20

Move multiple actors including constructors

HugoTroop HugoTroop

2017/12/20

#
Currently I am making a top-down tank game, and since the hull and turret operate relatively independently, they have their own separate actors. For the "AI" (its just random numbers), I have the same actor placed multiple times, and movement is done in a constructor. However, I cannot seem to get the turrets to move with the hulls. Is there a way to do this (or am I not clear) ? thanks
danpost danpost

2017/12/20

#
Constructors, in general, do not have anything to do with any actors in the world. I do not understand what you mean by "movement is done in a constructor". Certainly, the object being created is not yet in any world; so, "movement" is meaningless for it at the time the constructor executes. The turrets need to keep a reference to the hull they belong to so they can move with them.
You need to login to post a reply.