You can make two sprites and have them both sides of the main sprite and when they touch the walls or obstacles make the main sprite stop moving. I hope that makes sense, if not I have a few projects where I've done that. You can take a look at those if you want. Hope this helped
Offline