I have a question with sliders, wouldn't it make more sense to use max and min expression in the constrain position x to mouse position x, instead of accomplishing the same result by doing two different constrain attributes, one to make a max and one to make a min, it seems that one constrain attributes is better then two right?
Hmmm. I tried using fire maple's formula (from TSBooth's video tutorial), and, for some reason, as soon as I click my slider it doesn't constrain to the touch, but pop and locks into place at the min location. Any ideas what could cause that?
In my slider, I have two Attributes set: Slider_Min to 1298, and Slider_Max to 1776. These are both X coordinates on a double wide scene. (Ie. This is screen two so it starts at 1024 to 2048 in X)
My rule is: When actor receives event touch is pressed: Constrain Attribute self.PositionX to max(self.Slider_Min,min(self.Slider_Max,game.Mouse.Position.X))
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
edited January 2012
Hi ellfire, a possibility of solving your prob: take a look at the Rule under the Note "If you drag the slider past its left limit, constrain the X position to the left limit." and make sure, where it should say game.Mouse.Position.x is less than or equal to self.leftLimit, you haven't put more than or equal to.
Sorry, Gyro, I'm not sure where your getting and less than or equal to rule? Did I miss a step? I only used TSB's video, not the template linked above.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
edited January 2012
Oh right, I thought you used FMG's template.... I'll take a look tomorrow to see if I can find anything but as previously said, hopefully another member will come to your rescue in the meantime.... fingers crossed.
Edit: hang on, TSB's link IS for FMG's template... I'm confused again...
Edit again: maybe try replacing your line with the one supplied by FMG; just a thought...
Okay, so the mystery has been solved. My rule was just like TSB's in his video. What I wasn't accounting for was this: The scene in which the slider exists is 3072 wide by 1536 high. In it are 4 menus in a "T" configuration. I start out at the center top of the "T" then pan left, right, or down to show the other menu by interpolating the Camera Origin. The menus with the slider takes place at the bottom of the "T" between 1024 and 2048 in X. So, my Min and Max values for my slider were correct, but I had to add 1024 to the mouse/touch position to account for the fact this menu existed between 1024 and 2048 in X. Hope that makes sense to folks.
Thanks to everyone for offering your advice and templates.
Okay, new question: Does anyone know how to limit the volume slider. Ex. Now it correlates from zero to 1. Is there any way to correlate it so that the music maxes out at .7 say so that the default volume is .35?
Hmmm. Perhaps. What I ended up doing was taking all my various tracks and arranging a pseudo game session in a multitrack sound editor, found good mix levels, then reexported my sound at those levels. This way, at least, all sounds are relative to each other in a way that I think is a good mix. What they do with it with the Vol and SFX sliders, if up to them.
Comments
Constrain Attribute: self.Position.X To: max(self.leftLimit,min(self.rightLimit, Mouse.Position.X))
Maybe you put min on the first, you should put max there
My rule is:
When actor receives event touch is pressed:
Constrain Attribute self.PositionX to max(self.Slider_Min,min(self.Slider_Max,game.Mouse.Position.X))
your code seems good
Bray
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
No worries, Braydon
can you post a video record of it?
http://www.ellfireproductions.com/images/slider.mov
----------------------------------------------
http://davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Edit: hang on, TSB's link IS for FMG's template... I'm confused again...
Edit again: maybe try replacing your line with the one supplied by FMG; just a thought...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
http://forums.gamesalad.com/discussion/38132/gs-tool-box-a-free-mega-template-ready-now/p1
Theres also a video on page 2 showing you how to create a slider from scratch
Thanks to everyone for offering your advice and templates.