Keeping spawned actors when changing scene

AppulocityAppulocity Member, PRO Posts: 46

I am currently working on a game that requires the player to move from the main scene where the main actors are spawned, to a second scene to carry out other actions, before moving back to the main scene again. However the actors that had been spawned in the main scene disappear, how can I make them stay?

Thanks in advance

Comments

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    put the thing that made them spawn on the first scene on the second one... you should make a controller so you can manage everything easier!

  • AppulocityAppulocity Member, PRO Posts: 46
    edited October 2014

    @http_gamesalad said:
    put the thing that made them spawn on the first scene on the second one... you should make a controller so you can manage everything easier!

    I would, except I dont want those actors on the second scene, just the first scene

  • sswisehauptsswisehaupt Member, PRO Posts: 76

    So I am not sure what the solution is?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2014

    See my demo here: http://forums.gamesalad.com/discussion/comment/506569/#Comment_506569.

    The trick, though, with spawned actors would be to have a boolean or table value that changes when an actor is spawned and then have a rule in the spawner actor to spawn if those values have been changed.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • sswisehauptsswisehaupt Member, PRO Posts: 76

    I tried that. It remembers the position, but when I come back to the scene, the already spawned actor is gone. When the user spawns a new actor it is spawned to the saved attribute of the last one spawned.

  • sswisehauptsswisehaupt Member, PRO Posts: 76

    The actor only spawns when the user touches it.

  • sswisehauptsswisehaupt Member, PRO Posts: 76

    The demo saves the attribute, but I cannot get it to save the spawned actor. When the player taps on the actor to spawn it does spawn in the new saved attribute. I want it to spawn to the same place each time, and keep all the spawned.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Right, as I mentioned, you'd need to add to the demo. It doesn't do everything you want. It's just an example of how to store data for an actor's position.

    Spawning is a bit trickier as I alluded to. You'll need to figure out a system for keeping track of which actor was spawned and what its position was when the scene changed, and then for re-spawning and moving the actor to that same position.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822

    @sswisehaupt said:
    The demo saves the attribute, but I cannot get it to save the spawned actor.

    Use the attributes to re-spawn the actors in the correct location.

Sign In or Register to comment.