Problem with Sound Volume Slider from tshirtbooth's tutorial
Hey guys,
just a quick question. I set up a volume slider like tshirtbooth said or explained in his tutorial video.
But how do I save the position? Each time when I leave the scene the "ground" position of the slider gets set back and the new
sound volume selected does not get saved. I tried all kind of save attribute functions but all didn't work.
Thanks for help,
Alex
just a quick question. I set up a volume slider like tshirtbooth said or explained in his tutorial video.
But how do I save the position? Each time when I leave the scene the "ground" position of the slider gets set back and the new
sound volume selected does not get saved. I tried all kind of save attribute functions but all didn't work.
Thanks for help,
Alex
Comments
You're correct about using a Save Behavior, to save whatever attribute is associated with the sound volume (I haven't seen TSB's volume slider video so I don't know what that would be to name). But you'll find it, if you haven't already, I'm certain.
So the reason why the Save Attribute doesn't work is, for every Save Attribute Behavior you need a matching Load Attribute behaviour. THis is usually put into a Continue button with another Load Attribute Behavior for which level to go to as well, etc. For the New Game button (or whatever you'd like to call it - Start, for instance) that won't have any load Behaviors in it as you want the user to start a fresh game.
Hope that helps.
PS. Here's another of TSB's excellent videos explaining one use of Load and Save behaviours, which can be amended for your situation:
----------------------------------------------
http://davidgriffinapps.co.uk/
iPad: End of the Earth game coming soon to the iTunes App Store....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
thank you but I already did that. I know how to load and save attributes.
It works each time perfectly but in this case it does not work.
Alex
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
in the slider, I have when touch is pressed constrain self position X to .....etc.
and in this rule I also have the save attribute.
The load attribute is at the main menu standing alone...
Alex
try making another integer (real) called FinalVol:
So in the slider Rules, add---
When touch is released
Change attribute FinalVol to self.Position.X
Save Attribute FinalVol
and above and outside of the touch is pressed Rules for the slider touch, put
Change attribute self.Position.x to Finalvol
Then your Load attribute at the beginning of your game will be FinalVol
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I'm guessing your problem isn't with Loading and Saving, but with the fact that when you revisit the volume slider screen, the slider position on the screen actually sets the volume. You don't have a rule repositioning the slider to reflect the current volume when the player enters the volume change screen.
Try this:
Add a Change Attribute to the slider knob object.
Change Attribute: self.Position.X
to
game.Volume Music *( self.Slider Max - self.Slider Min )+ self.Slider Min
(replace game.Volume Music with whatever attribute you're using to store the 0-1 volume value for your game.)
This worked for me.
That's good, that would work but the other way around!
My suggestion does need adding - outside of the touch pressed rule: - change attribute self.Position.x to FinalVol to set the position of the slider. (Edit: oh, I already wrote that.... ;-) ) As the volume is already constrained to this, the correct volume should be set.
As for save and load attributes, you're correct about not needing them for returning to a scene in-game; for the record, I assumed Alex wanted them as he mentioned Save attribute. I guess there's no need to remember the volume when returning to the game again, just in-game. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
It doesn't' work
Okey it works, but is there a way to use something other than touch is released. Because when you slide not exactly,
the attribute doesn't get changed...
thank you :DD
Edit: also, make sure that FinalVol is a game attribute, not a scene attribute and it should be good to go.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Alex