Loss all power on 2002 Kia Spectra

I drove my car fine for almost 2 weeks. Then one day I turned the car on and started warming it up, everything sounded fine until it was warmed up to the 1/4 mark. When all of a sudden it started sputtering and then engine died out. Then it would turn back on and immediately die out. Then we had it drained the tank filled with premium, also changed spark plugs and coil wires. We drove it for a while and trying to go on any sort of incline it lost all power and went about 25mph with gas fully pressed & would stall if not pressing the gas. Going down the incline it seemed to run a lot better, no stalling at all unless coming to a stop and go. After doing about30-40 miles seemed like either incline or decline its lost all power either way even on just flat ground top speed would be about 25 mph. The check engine light is on and sometimes flashes continuously for a min or 2 then stays lit.

Asked by for the 2002 Kia Spectra
flashing check engine light indicate a misfire on one or more cyc. I highly recommend you get engine diagnostic to prevent major issues from happing. The check engine light should give you a code wish will indicate the falling system