One code wall hitest

is there one code that i have to put in the wall/boundaries or in the hero that will make sure that the hero will not go past them…?