Sliding button - is it possible?
digitaldurian
Member Posts: 15
Hey there, I'm trying to do a pause button which 'slides' to another position when it's touched, and slides back when I touch it again. Kind of like a flip switch, which changes to another state when flipped and holds until I flip it back again.
Basically, this is what I have in mind. Do a Game boolean attribute: flipped, true or false
When touch released & flipped is false, change attribute flipped to true, interpolate to new_x for 0.5 secs
When touch is released & flipped is true, change to false and interpolate back to old_x for 0.5 secs
Forget about the pause part first, I can't even get the button to work so I want to solve this first.
In my puny mind, it seems logical to me, but it doesn't work when I tried it. How is it possible? Any ideas from the masters?
Basically, this is what I have in mind. Do a Game boolean attribute: flipped, true or false
When touch released & flipped is false, change attribute flipped to true, interpolate to new_x for 0.5 secs
When touch is released & flipped is true, change to false and interpolate back to old_x for 0.5 secs
Forget about the pause part first, I can't even get the button to work so I want to solve this first.
In my puny mind, it seems logical to me, but it doesn't work when I tried it. How is it possible? Any ideas from the masters?
Comments
So normally for buttons you want to use a touch is pressed rule
Try this
Make an integer attribute called flip
Then a rule
When touch is pressed
--Change Attribute game.flip to (game.flip+1)%2
Then a second rule
When game.flip = 1
--interpolate self.position.x to new.x
Otherwise
--interpolate self.position.x to old.x
Hope that helps
___________________________________________________________________________________
Project Help from Tenrdrmer Click Here
GS BubbleBall Template HERE!!
Stacks Level Selection Template HERE!!
Expanding Option Menu Template HERE!!
Tenrdrmer's Menu # 3 HERE!!
Menu #4 - Level Banners HERE!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes
http://gamesalad.com/forums/topic.php?id=23253
@youngster9 - Hey there it isn't exactly what I'm looking for but it's cool to know that tshirtbooth did something like that so thanks for sharing! Might be useful for my future projects!