The waves of an earthquake come in two formss. P waves (yellow) arrive fastest and compress and punch the rock. S waves (red) are slower but more destructive. They move from side to side to shake and destroy buildings. The building features in blue, such as deep foundations, can protect a building from earthquakes.