Spawning an Actor Relative to Other Actor

CaptMediaCaptMedia Member Posts: 60
edited November -1 in Working with GS (Mac)
Is there anyway to spawn a random actor in relation to another actor in the scene. I am creating a game with a scrolling background and moving actor. I would like to spawn the actors right above the moving actor but since I have a scrolling background I cannot put in a specific value in for where I would like the actors to spawn. So basically my question is, is there anyway to spawn an actor relative to another actor on a scrolling screen? Thanks in advance for your time, if you need any other information please ask!

Comments

  • wouterwouter Member Posts: 174
    yeah just get the x and y coordinates of the actor (self position x and y) and set them in a game attribute (game.X and game.Y).
    then spawn another actor on coordinates: game.X+whateveryouwant and game.Y-whateveryouwant;)
  • wouterwouter Member Posts: 174
    (so constrain attribute game.X to: self.Position.X
    and constrain attribute game.Y to self.Position.Y
  • CaptMediaCaptMedia Member Posts: 60
    Dude you're the best thanks so much!
  • wouterwouter Member Posts: 174
    no problem;)
  • CaptMediaCaptMedia Member Posts: 60
    One more question...is there anyway to delete the spawned actor once it leaves the scene? I tried to create an actor and when one of the spawned actors collided with it, it would destroy the spawned actor but that didn't work because it deleted the actors before they even spawned. Any ideas?
Sign In or Register to comment.