recycle actor to random location

wmgeichwmgeich Member, PRO Posts: 28
edited November -1 in Working with GS (Mac)
I've watched Darren's video, even checked out his vertical shooter and shoot em up game. I'd like to recycle 5 actors that randomly appear on the screen and after they've been tapped, they return to an off screen location to be available to recycle/randomly appear at another random location on the screen. The tutorial videos all seem to drop down from the top or side, I need them to appear out of thin air at random locations (read interpolate). I've already tweaked Darren's rules and behaviors but need an alternative behavior or rule to have them appear randomly and not drop down. (I know I'm repeating myself, sorry)
Any help is greatly appreciated!

Bill

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    this is how i would do it.

    have the actors alpha set to 0 have it wherever onscreen. make a rule when attribute alpha=0 change attribute self position x to random(0,480) and change attribute self position y to random(0,320).

    have a timer by itself every 7 seconds change attirubte self color alpha to 1

    then have one more rule when touch is pressed change attribute self color alpha to 0

    you would put that in every actor you want it to happen to
  • wmgeichwmgeich Member, PRO Posts: 28
    This worked. Thanks so much. My problem now is when touch is pressed and the actor recycles, I have an explosion follow at the same position just like Darren's video but the explosion image appears at the bottom of the screen, directly below where the tap occurred ("destroy"). In Darren's video the explosion occurs at the location of the tap. I copied Darren's code exactly as it is in the video using real attributes of ActorX and ActorY.

    Thoughts?

    Bill
Sign In or Register to comment.