Walls in game

how do i make it so that my hero cannot pass through walls?