How do I do this?

rinorino Member Posts: 17
edited November -1 in Working with GS (Mac)
Hi there, this should be an easy question for most of you but I can't figure out how to do it yet.

I have a spawner that spawns actors on random points and I want to all to converge on one target or one spot on the screen.

Or in other words, I want the spawned actor to 'follow' or reach the target (which is in the middle of my screen).

How should I do this?

Thank you!

Comments

  • patm1982patm1982 Member Posts: 50
    you can use the MOVE TO, or ACCELERATE TOWARD behaviors in each actor. and set the X & Y you want.

    If your target is a player, then you can set a global variable for the players X & Y, and then in your player actor update that variable every so often(self.position.X & self.position.Y). and set the Player X & Y variable as your X & Y in the MOVE TO behavior on the spawned actor..

    ...BTW if your developing for iphone avoid using the spawn, it will absolutely kill your performance.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
  • rinorino Member Posts: 17
    Thanks guys!

    And thank you for the 'BTW" comment, so if I want to develop for the iphone how could I not use a spawner and still spawner actors (spawning around 10-30) a level.

    Would it be better to put them all outsdie of the screen and delay movement?

    Thanks!
  • mithraweptmithrawept Member, PRO Posts: 167
    Yeah. Have all the actors off screen and move them on when you need them.
  • patm1982patm1982 Member Posts: 50
    Ya thats what Ive been doing too. Also you should set it up so if the enemies are off screen they will be frozen, that really helped my iphone performance.

    Also let me clarify my statement about spawn killing performance. If your doing a lot of spawns at a time, then yes it will hurt performance (like firing bullets for instance). If your just occasionally using it to add an actor, I don't think it will take that big of a toll on your performance. In fact I'm wondering if it might help performance to spawn those actors every once in a while, as opposed to starting the scene with tons & tons of actors. I'll be doing some of those tests myself. and let people know what I find out.

    Do you have a iphone/ipod to test on? I think thats the best thing to do. I know when I finally got my ipod touch3G setup with GS, I ended up spending 1/2 week optimizing my rules.
Sign In or Register to comment.