The Flood happened because the people had become so wicked and had turned so far from Him that there was no hope of them repenting in this life. It's called being "ripe in iniquity". Unfortunately, there are many in every age who reach that sorry state of affairs. But He promised never again to flood the earth, and set the rainbow in the sky as evidence of that covenant. The next, and final, time He will cleanse the earth of unrelieved wickedness will be by fire. There are consequences to wickedness and unholy behavior, whether people choose to see them or not.