Hello guys I was wondering how can we get the button on our apps to look like they are being pressed (i.e the play button in Mega Jump) to add a more realistic feel to it.
Obviously this depends in the look you want. If you really want it to look like a pushed button then draw a pushed button and a non-pushed button and change the image between the two when pressed.
There's no need for timer here. For more natural action, do the following...
Just create an integer attribute (self.pressed, initialized to 0) that gets cycled to 1 on touch is pressed. That would also trigger any "pressed" animation or image change. Then, create a rule for your action, check for touch is released AND self.pressed = 1. At the end of the actions in that rule, reset self.pressed to 0.
This will hold the action until the touch is lifted from a given button.
Comments
For example if it is a change scene button:
When actor receives event touch is pressed
Change attribute self.width = 55
Change attribute self.height = 15
Play sound somesound.ogg
Timer after 0.5 secs - Change scene to .......
In the otherwise bit:
Change attribute self.width = 60
Change attribute self.height = 20
Obviously this depends in the look you want. If you really want it to look like a pushed button then draw a pushed button and a non-pushed button and change the image between the two when pressed.
Just create an integer attribute (self.pressed, initialized to 0) that gets cycled to 1 on touch is pressed. That would also trigger any "pressed" animation or image change. Then, create a rule for your action, check for touch is released AND self.pressed = 1. At the end of the actions in that rule, reset self.pressed to 0.
This will hold the action until the touch is lifted from a given button.