saving spawned actors best practices

peastonpeaston Member, PRO Posts: 25
Hi All,
I was wonder if their was a "best practice" method of saving spawned characters so I can leave and come back to a scene and have spawned actors still be there.
Any pointer/examples would be greatly appreciated.

Pete

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2013
    Best practice would be not to spawn them but rather to hide and then reveal them (e.g. with self.color.Alpha=0 or 1). That way you don't have to spawn and destroy them. You can control their visibility with a game attribute that doesn't get reset scene-to-scene. Or is there a reason you need to spawn them (e.g. they are bullets, enemies, etc.)?

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

  • peastonpeaston Member, PRO Posts: 25
    It's a sticker book so they need to be able to have as many copies as they want.
  • master200012master200012 Member Posts: 372
    Is using "Replicate" an option?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    It's a sticker book so they need to be able to have as many copies as they want.
    Here's a somewhat complex but effective way to do it:
    In your sticker actor, have a behavior that saves its x & y position and sticker "type" to a table.
    Have a "respawn" actor that loops through the table rows and spawns each sticker type at its x & y position

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

  • peastonpeaston Member, PRO Posts: 25
    yeah that's what i was thinking, adding a touch release to save the image name,x & y then reload them when the user returns.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @peaston I made you a demo. Click on a sticker to select it. Click again, drag and release to place it. When you switch scenes and return, the stickers are in their same locations and you can then add more.

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

  • peastonpeaston Member, PRO Posts: 25
    thanks, i've already corrected the double click now i'll try integrating what you've created. thanks again
Sign In or Register to comment.