How does habitat shape animal behavior?

When an animal lives in a certain place, it must take in its surroundings. The environment around any animal will manipulate how the animal hunts, its colour etc, so its behaviour. For example, for the lion to survive, it must mate with as many females as it can and drive away the other males so that the bloodline of lions would continue. It has also learned to stalk animals and has changed its colour to a sandy yellow to move stealthily through dry grass.