how can i make a script that when you tilt the android something happens and make a button on android?

how can i make a script that when you tilt the android something happens and make a button on android?