Recycling actors help!

I am making a ninja pong game and i want to know how to recycle the actors as the have like random speeds so when it is recycled there will be a lot of actors with fixed speeds coming at the same time help!
Best Answer
-
stackpoole Melbourne, Victoria, AustraliaPosts: 473
firstly you make some actors that are going in the speeds -
assign them a speed, normally you user the "move" or "accelerate" behaviours.
to recycle you have to put your actors on the scene. After this, the actors hit another actor such as a "wall." or whatever you are using to hit the actors. when it does this you make a rule
when "actor" overlaps or collides with "wall"
[change attribute] self.positionX ... to ... [where you want it in X] e.g. [random(200)]
[change attribute] self.positionY ... to ... [where you want it in Y] e.g. [random(200)]
*so recycling just means moving the actor to a different position
*this is basic as I do not know what your game will be like.
OR you can watch this video.
or
Hope this helps!Sydney Swans 2014!!
Answers
Brendan