Kid's dad here. My goal was only to "teach him to code" .. the motivation to build a game was all his. He mixed something something he loves (fantasy worlds) with something that's useful (learning to code), so I think that helped with the motivation to keep going.