add new if for detect which foot is forward, refine demo script