Getting back on track with healthy food

For a while I was doing really great with focusing on eating foods that nourish my body. But lately I’ve been down, and when I’m down I like to eat lots of sugary foods. I’ve broken the rule I had for myself of not eating past 8pm because after 8 is when I eat the most bad foods. I would really like to get back on track, but am finding it hard to find the motivation.