This is because you have inhaled too much of the fumes from the spray paint. The best way to avoid this is to wear a respirator mask while spray painting. If you have inhaled too much of the fumes, then you should go outside and get some fresh air.