Saving Attributes Issues
Hi all,
I realise there are lots of saving attributes threads already, I was just having a few technical problems so had to make a new one, I apologize.
When I change an attribute in Scene 1, I am able to save it and then load it in Scene 2, however in my game there is a link back to Scene 1 and when I then go back to Scene 1 (not resetting the game, going back within the game) the value of that saved attribute is different (usually less than what it was saved as originally.
Has anyone else had this issue or is there anything I may be doing wrong?
Thanks,
SC
I realise there are lots of saving attributes threads already, I was just having a few technical problems so had to make a new one, I apologize.
When I change an attribute in Scene 1, I am able to save it and then load it in Scene 2, however in my game there is a link back to Scene 1 and when I then go back to Scene 1 (not resetting the game, going back within the game) the value of that saved attribute is different (usually less than what it was saved as originally.
Has anyone else had this issue or is there anything I may be doing wrong?
Thanks,
SC
Comments
First , when you save attribute in scene 1 , there is no need to load it in scene 2 ,
The purpose of saving attributes is for when you exit the game and the return to play it later , you can load all the progress you made in the previous session ,
So no need to load attributes when you change scenes (the value will not change anyway)
As for your problem , what happens in scene 2 to this attribute? do you change it ?
Roy.
With my game, without boring you with too much detail in Scene 1 (home screen) for Actor A some attributes are changed (i.e. the maximum speed as it is a racing game). Those changed attributes for Actor A need to be carried over to Scene 2 (the actual race). Going from what you said, then how do I ensure those changed attributes are carried over to Scene 2? The only way I have been able to do it thus far is by saving and loading, but more than happy to hear if there is a better way.
Thanks again,
SC
Create a game.attribute - integer - call it "maximum speed value"
In scene 1 , right before you go to scene 2 ,
change "game.maximum speed value" to the value you want , (and save it if you want this value to stay the same next time the player opens you game)
Now in your scene 2 , simply access this attribute to whatever you need ..
If you have more questions please ask.
Roy.
Thank you very much, one question (sorry I am still learning), will this change the actual speed that that Actor A moves at? The only reason I have been changing the maximum speed is that I have found it the most effective way to change how quickly the Actor moves.
Thanks again,
SC.
BUT , i think its wrong to use it the way you use it , in your actor (car) what type of behavior you use to move it around?
move? move to? accelerate? change self velocity?
Either way , i would suggest giving your car the appropriate speed you want instead of giving it a huge speed value but limit it with max speed .
Also , if you are new (we all were) take a look at templates like "Overhead Car Race" and "Space Rocks Template" to learn about actors movements and velocity !
Roy.
To answer my question would I be better off creating an integer (as you suggested) and instead of changing the maximum speed attribute directly, make rules that when integer = 1, maximum speed = 20, when integer = 2, maximum speed = 21 etc? Therefore, I would be changing the integer (which remains constant across the scenes) and not the maximum speed.
Thanks again,
SC
What i suggested is to make an integer , and give it the value of your desired speed ,
so the in your car , lets say you have a behavior "move" than in the speed value of that behavior , use that attribute .
Roy.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
cheers