If 'walk' is an integer type, then this is kind of sketchy:
walk = !walk
On the other hand, if it's a bool, then this is kind of sketchy:
if (walk == 1)
Yet, another example where posting full code (including variable definitions) would have been helpful.