Something a bit complex for my tiny brain....

AfterBurnettAfterBurnett Member Posts: 3,474
edited November -1 in Working with GS (Mac)
Okay, so I understand how to get stuff moving in a circle (actually I don't, I'm just using tutorials - LOL). My question is, how do I get that circle to follow another actor? What I want to do is have a ring of actors spinning around a boss character... you have to destroy them before you can get to the boss... this would be simple but I want the boss to move.

Any thoughts?

Comments

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Could you constrain the boss's X and Y positions. Then on the actor circling the boss, have it move to those positions plus an offset. If your actor is already doing a big circle you could prob constrain or move to boss's X position + 100 (or whatever), this means when the boss moves it keeps it always a set distance away. You will need to do this with Y as well.

    Hope that helps
  • firemaplegamesfiremaplegames Member Posts: 3,211
    You need to make two global game attributes, bossX and bossY.

    In the boss Actor Prototype, add these two behaviors:

    Constrain Attribute: game.bossX To: self.Position.X
    Constrain Attribute: game.bossY To: self.Position.Y

    In the Orbiting Actor Prototype, add these Attributes:

    an integer Attribute called 'myRadius' - set this to 100
    an integer Attribute called 'mySpeed' - set this to 400
    an integer Attribute called 'myOffset' - leave this blank for now

    Then add these two behaviors:

    Constrain Attribute: self.Position.X To: self.myRadius*cos(( self.Time + self.myOffset)*self.mySpeed%360)+ game.bossX

    Constrain Attribute: self.Position.Y To: self.myRadius*sin(( self.Time + self.myOffset)*self.mySpeed%360)+ game.bossY

    Now, drag the boss Actor as well as many orbiters as you want into the Scene.
    Double-click on each orbiter instance and set their 'myOffset' Attribute.
    This will be their distance between each other...(otherwise they would all be on top of one another)

    (The only thing to watch out for is that each orbiter requires 2 Constrains...
    too many Constrains will negatively affect the FPS)

    Hope this helps!
    Joe
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Thanks Joe! I'm not too worried about constrains... really just gonna target the newer devices with this game as there is so much happening on screen at once the older iDevices just can't cope. I may implement a "no animations" mode as QS suggested but I'm not too sure even that will help...
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Oh and because it's retro inspired I have to do a custom font score, which means constrains... which counts out older devices anyway. lol.
  • RattleheadRattlehead Member Posts: 485
    Would rebumps demo help you?

    http://gamesalad.com/game/play/39926
  • AfterBurnettAfterBurnett Member Posts: 3,474
    I've got it working, thanks Joe! But have a problem... it works fine when in my test scene as I can place all the actors. However, in the actual game, the boss is spawned with a timer so I can't drag the actors in to place. The only way I can think of doing it is having a load of separate shield actors, each with different offsets. Is there another way other than having to copy all these actors?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    hmmm... you could have them already in the Scene. Just outside of view until they are needed?

    I'll think about it..
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Yeah I thought about that too but might be a bit too much for the poor old GPU.
Sign In or Register to comment.