The Nightmare appears prior to the game's beginning, leading an attack on Apolko kingdom with his minions and seizing the castle. He then proceeds to capture the 7 princesses and forces the king to flee his kingdom, along with Liam, Verde, Pancho, Howser, and Azure. Shortly after, he seals the 7 princesses in giant pillars of light, and commands several of his minions to guard the princesses, as well as prevent the King from saving them. The pillars of light are used to hold up a barrier, preventing anyone from easily entering.
The Nightmare is revealed after saving 3 princesses, and appears before the king after passing through Boney Tunnel. He taunts the king and warns him to stop saving any more princesses before disappearing from view.
The Nightmare doesn't reappear again until the King saves all 7 princesses. He leads an attack on the new Alpoko Kingdom, and once again captures the 7 princesses, explaining that their light was the key to his barrier over the former Apolko Kingdom. However, he congratulates the King for getting past his guards and saving the princesses, and offers him the chance to redeem himself by telling him to search for the 7 crystals he created from each princesses "light", which he will scatter across the land once more, claiming that if the King doesn't retrieve all 7 crystals by the time 3 earthquakes occur, the world will end. After taunting the King once more, he disappears.
After getting all 7 crystals, the King will have a dream where he will communicate with Azure, and learn that The Nightmare is a being that feeds for negative emotions and the darkness in people's hearts. The Nightmare will appear shortly after and remove Azure from the dream, taunt the King once again, and disappear once the king wakes up.
The Nightmare will appear one final time as the final boss, where he congradulates the King for making it as far as he had, and accuses him of selfishly leaving his subjects behind. He then seals the princess(or Verde) that is paired with the King, and laugh before the start of the first phase of his battle.
Once defeated the first time, he will go into a fit of rage, claiming that he will now get serious, and proceed to attack the king once more. Once defeated, he will slowly vanish from existance permenantly, saying that it was a good dream while it lasted.