Volume slider not working on big scene. PLEASE HELP!
So for the past two hours I've been Trynna crack this but with partial success.
The scene I'm working on is 2048 pixels in width.
I created the knob (to slide left and right for volume adjustment.
The knob has 2 self attributes.
Slider min (index) is set to 1350
Slider max(index) is set to 1630
I also placed this knob's x position at 1630 so that the volume is defaulted at high volume.
In the knob's rules I put
When touch is pressed
Constrain attribute to
Max(self. Slider min,min(self. Slider max,game. Mouse position. X))
And it works partially. But still useless. When testing the volume slider in the GS viewer on my Mac this is what happens:
Load scene
I click on the knob and it moves all the way towards the left of the scene. In order to see it I have to drag all the way to right even passing the playing field (all the way to the dark gray area seen on the GS viewer).
I think it's because I have to make some adjustments since I took this from a template that was made on a 480x320 scene.
You see, im trying to get this working on the iPad. The scene size is 2048x768. The first HALF of this scene is the title screen. When I touch the "options" button, I have the "camera origin x" move to 1024. Which is the second half of the scene across towards the right. There I have my sound settings.
I think the issues might have to do with the knob's self.Slider min and self. Slider max attributes. I tried both index and real. No avail.
Here's what I want.
The volume knob placed at x position 1630
Max slide limit is at 1630 (so the volume is high by default)
Min slide limit would be some where at x position 1300.
Any help would be appreciated.
I could just create "off -low-medium-high" buttons but sliders are better looking.
Can somebody help me? Thanks guys
The scene I'm working on is 2048 pixels in width.
I created the knob (to slide left and right for volume adjustment.
The knob has 2 self attributes.
Slider min (index) is set to 1350
Slider max(index) is set to 1630
I also placed this knob's x position at 1630 so that the volume is defaulted at high volume.
In the knob's rules I put
When touch is pressed
Constrain attribute to
Max(self. Slider min,min(self. Slider max,game. Mouse position. X))
And it works partially. But still useless. When testing the volume slider in the GS viewer on my Mac this is what happens:
Load scene
I click on the knob and it moves all the way towards the left of the scene. In order to see it I have to drag all the way to right even passing the playing field (all the way to the dark gray area seen on the GS viewer).
I think it's because I have to make some adjustments since I took this from a template that was made on a 480x320 scene.
You see, im trying to get this working on the iPad. The scene size is 2048x768. The first HALF of this scene is the title screen. When I touch the "options" button, I have the "camera origin x" move to 1024. Which is the second half of the scene across towards the right. There I have my sound settings.
I think the issues might have to do with the knob's self.Slider min and self. Slider max attributes. I tried both index and real. No avail.
Here's what I want.
The volume knob placed at x position 1630
Max slide limit is at 1630 (so the volume is high by default)
Min slide limit would be some where at x position 1300.
Any help would be appreciated.
I could just create "off -low-medium-high" buttons but sliders are better looking.
Can somebody help me? Thanks guys

Comments
max( Slider.minimum ,min( Slider.maximum , (game.Touches.Touch 1.X+SCENE.ORIGIN.X) ))
Roy.
Thank you so much POM. that worked perfectly