If actors spawn periodically and wander, how can I save each actors position?!

TheStrangeOne

  • *
  • Posts: 103
I have a scene where actors of 3 different kinds spawn periodically.

Example:
after 5 - 10 seconds.
create random number between 1 and 3
If random number = 1: spawns actor1
If random number = 2: spawn actor2
If random number = 3: spawn actor3

This continues for the entire scene until the number of actors on scene = the actor cap I have created (16)

I have everything working fine, but if I close the game and open it, all my actors are gone. I have no idea how to save all of their positions and actor types? Thankyou to anyone who takes the time to help :)

t4u

  • Posts: 418
Make list(global variable) of your actors position and type(n =x, n+1=y, n+2=type) and save it(either on click or periodically). Upon entering the game make option to load from list.
USE PICTURES WHEN YOU ASK SOMETHING!
If I helped you be sure to mention it in your game.

Tutorials + downloads:
http://t4upl.blogspot.com/

TheStrangeOne

  • *
  • Posts: 103
Thankyou for the reply, I have never used lists before so Im kind of lost. Im assuming this is all placed on a scene event? would you know of any examples I can use to help me understand what I would need to do? :)

t4u

  • Posts: 418
You will have your list in the same behavior where you spawn your actors - so probably scene behavior.

Do your reading on lists and global variables.
USE PICTURES WHEN YOU ASK SOMETHING!
If I helped you be sure to mention it in your game.

Tutorials + downloads:
http://t4upl.blogspot.com/