Spawning Actors + Wrapping Background Problem

I'm currently trying my hand at an infinite runner-type game. I have platforms/buildings randomly spawning, but I also have a scrolling background to sort of repeat/wrap. I can't for the life of me, figure out how to wrap the background infinitely, without also wrapping all of the platforms.

I've tried adding a destroy feature for the platforms, but I don't like the way they disappear before they completely slide off the screen.

Sorry if this has been discussed before, I looked and didn't find anything. Any help would be greatly appreciated, thanks! Also I've looked everywhere for a DECENT runner template and all the links on here i've found are dead. If anyone would like to share a good template (if similar to Robot Unicorn) I'd greatly appreciate that too. My e-mail: rochetype@gmail.com

Comments

  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    edited January 2013
    Make the scene longer than it needs to be.

    The platforms can wrap around to the other side of the scene and will be off camera to the right. Have another actor there that destroys the platforms when it touches them. This way the platforms can move all the way past the camera and get destroyed off screen.

    You also need to make sure that your platforms don't spawn in contact with the destroyer. Just toy with the spacing and scene width a bit.
  • rochetyperochetype Member Posts: 3
    thanks for responding! The background looks great now! The only problem is the platforms are getting permanently destroyed now and not re-spawning.. way around this?
  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    well I thought you wanted to destroy them. You'd have to spawn new ones if you destroy old ones.

    If you're spawning them and they are overlapping with your destroyer then they will be destroyed. Make sure you are not spawning new actors on top of the destroyer.
  • rochetyperochetype Member Posts: 3
    so for an infinite runner game, is the best way to produce all of the platforms by spawning about a 100 different actors and destroying them all? or is my method flawed...

    i apologize for my nubity.
  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    No, spawning isn't the only way. If the background is wrapping you could just let them go round and round. Or you could recycle them.

    http://forums.gamesalad.com/discussion/51308
    http://forums.gamesalad.com/discussion/37988

    Some more information.

Sign In or Register to comment.