Scene change - saving positions

stemarthestemarthe Member Posts: 4
edited November -1 in Working with GS (Mac)
Hi! this is my first post!

I had a couple of questions and searching the forums and reading what you guys have to say is really helpfull...

But I need some help on this one.

How does the rules in an actor compile? I mean, does GS read the rules from top to bottom as is you were in a code? Can I for example have 2 fixed rules such as

change attribute to something
change attribute to something

have an if event
resolve the if event

in other words, when the scene is loaded and the actor is spawned, will it change the attributes and then check the if statement?

Furthermore, when I was trying this, it kindda seemed to work as such as I had an actor with an initial position, a button to move that actor, another button to change scene.

When I click to move actor a couple of times, then click the change scene, and then click a change scene on that new scene to come back to original scene, the actor had the previous to last position and not the last...

What I did was have the actor save it x,y position, if mouse down and inside move a distance. Once moved, save new x,y position

In turn when you load it should load the very last position but did not. In fact loaded the before last position witch is kinda weird.

Also, i was reading here about memory leaking when changing scenes...is this a real problem and if so, have something like Im trying to do, changing scenes back and forth might cause some big problems in the end?

Thanks for the help guys!

back to GS now!

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    stemarthe said:
    Hi! this is my first post!

    I had a couple of questions and searching the forums and reading what you guys have to say is really helpfull...

    But I need some help on this one.

    How does the rules in an actor compile? I mean, does GS read the rules from top to bottom as is you were in a code? Can I for example have 2 fixed rules such as

    change attribute to something
    change attribute to something

    have an if event
    resolve the if event

    in other words, when the scene is loaded and the actor is spawned, will it change the attributes and then check the if statement?

    Hi stemarthe, welcome to Forum posting! In your example above, if I've understood correctly, if the first attribute is 1 for instance, and the second is 2, then if event, say if (when) attribute is 2, resolve it, should would work just fine. You could also have when attribute is 1 then whatever else as well, of course. Don't know if my confirmation helps at all, hopefully it does!
    stemarthe said:

    Furthermore, when I was trying this, it kindda seemed to work as such as I had an actor with an initial position, a button to move that actor, another button to change scene.

    When I click to move actor a couple of times, then click the change scene, and then click a change scene on that new scene to come back to original scene, the actor had the previous to last position and not the last...

    What I did was have the actor save it x,y position, if mouse down and inside move a distance. Once moved, save new x,y position

    In turn when you load it should load the very last position but did not. In fact loaded the before last position witch is kinda weird.

    Are you checking this on a Mac? Anything involving Load and Save Behaviours can only be seen to be working on an actual iDevice.
    stemarthe said:

    Also, i was reading here about memory leaking when changing scenes...is this a real problem and if so, have something like Im trying to do, changing scenes back and forth might cause some big problems in the end?

    This is when using GameSalad. Just make sure you save regularly, with backups if possible, and quit the GS app every ten to fifteen minutes or so, to restart, when the responses start getting a bit sluggish.

    Hope i've been of some help!

    :-\

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • Rob2Rob2 Member Posts: 2,402
    save and load attrib works ok on Mac
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Rob2 said:
    save and load attrib works ok on Mac

    Well, that's brilliant news, Rob; thank you! (I was informed not that long ago on the Forum that it wasn't possible). I'll do a test tomorrow. Sorry to mislead you, stemarthe. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • stemarthestemarthe Member Posts: 4
    Cool thanks!

    Here is what I was trying to do. I have a ship actor.

    The ship movements are in this ship actor.

    So I want to have the ship load its last known position.

    Then go into the if statement that makes the ship move, and once move update this new position. So when I change scene and come back it will enter as the last known location of actor.

    So...

    ive got a change attribute to x and y positions from some game attribute

    then I got to the movement and once moved send its new location to the game attribute I created.
    gyroscope said:
    Hi stemarthe, welcome to Forum posting! In your example above, if I've understood correctly, if the first attribute is 1 for instance, and the second is 2, then if event, say if (when) attribute is 2, resolve it, should would work just fine. You could also have when attribute is 1 then whatever else as well, of course. Don't know if my confirmation helps at all, hopefully it does!

    Are you checking this on a Mac? Anything involving Load and Save Behaviours can only be seen to be working on an actual iDevice.

    This is when using GameSalad. Just make sure you save regularly, with backups if possible, and quit the GS app every ten to fifteen minutes or so, to restart, when the responses start getting a bit sluggish.

    Hope i've been of some help!

    :-\

    As for this, does this also mean on the device I wont have any problems going back and forth from and to a scene or will the user have to reboot after a while?

    Thanks again guys!
Sign In or Register to comment.