When you see obstacle come to you you have to jump other wise its touched by the sprit it will be out.
View this project in Scratch
Scratch
Web
Advanced programming