actor reset pos issue
hi.
i have a issues that needs something small to get it to work.
picture 4 actors scroll across the screen from right to left and if they hit a wall or get shot by an enemy then they reset to x y location. the problem im having is the if you let a few go (not shot by enemy) and then i shoot an oncoming one then the one that i let go and the one i shot both get reset to same xy and then overlape. Basically im utilizing the recycle method instead of spawning . what is my way out here. basically the same actors scroll and scroll continously by being reset to xy pos but i want them to continue scroll at same distance apart without overlapping each other.
Im sorry if this is hard to get and i can certainly appreciate how it might.
any help would be appreciated.
cheers
Robbo
i have a issues that needs something small to get it to work.
picture 4 actors scroll across the screen from right to left and if they hit a wall or get shot by an enemy then they reset to x y location. the problem im having is the if you let a few go (not shot by enemy) and then i shoot an oncoming one then the one that i let go and the one i shot both get reset to same xy and then overlape. Basically im utilizing the recycle method instead of spawning . what is my way out here. basically the same actors scroll and scroll continously by being reset to xy pos but i want them to continue scroll at same distance apart without overlapping each other.
Im sorry if this is hard to get and i can certainly appreciate how it might.
any help would be appreciated.
cheers
Robbo
Comments
no. only one is moved back to start locaton of x (x - to keep it simple). so basically two things cause an actor to reset to start pos of x. the first is if that
actor hit a leftwall or second, if it's shot by enemy. so think of say 3 boxes moving from right to left (in landscape left) scrolling along and they are either shot by enemy or hit leftwall for reset back to start location x. all i want to accomplish is to have them recycle in same order endlessly but im finding the issue is i cant do this successfully because sometimes they overlape based on what is happening on screen. for example if i leave left actor1(box1) alone and dont shoot it , it will finally hit the leftwall and reset to startx(500) and then if i immediately hit actor2(box2) it will also reset to startx(500) and then they are both on same x coordinate causing overlap.
all i know is i want to avoid spawning (which did work perfectly btw) for performance reasons. question is how do i get all actors based to always recycle on x coordinate without ever overlaping each other whether they are shot or hit a leftwall.
many thanks
this actors are always in the same Y right? they only move in X, and if they get recycled in the same moment they will overlap?,you can make them spawn on random x position instead of the same coordinate OR, you can make a rule on this actor, if they collide between them, then change the speed of one of the boxes for a few seconds or sth like that
on each box: have a unique origX start Pos … box1 origX=500; box2 origX= 550; box3 origX =600
???
MH
just to answer that YES they all do have same y path and MH they all do have unique start pos and all works great if i dont shoot them. coz what im doing is resetting them each to their start posx but if i shoot boxes out of order and because they are sharing same y path line they will overlap as they walk the same y path line back on screen. can you see what i mean. so if i shoot box3 then it will reset to origx=600 lets says right!!! but if box1 almost off left screen and just as it collide with leftwall(which also resets startpos). so how can i get them all to always reset to their start pos x without ever overlapping each other as they scroll left on screen.