ð
g get's smaller per frame so always change y by g, this makes ball fall faster.So if touching floor set g to 0-g so if g is down it will turn up.But in real live it bounces less high than last time so set g to g/?.? is 1/bounce so if bounce is high it will be divided less.Than +1 so it dose not go higher add a block:go out. if touching roof/floor set s to 0-g so you can know what way the ball will go.Then if s=abs of s that means if s=positive s.Then change y by 1 until your not touching the walls.Else so if touching roof then change y by -1 until your not touching the walls.