Even though online learning has become the 'new normal' in many educational institutes around the world, its implementation is not always smooth sailing. Fully online learning often suffers from a lack of student engagement. It is therefore important for us to explore ways to alleviate student disengagement in online learning. In this study, we report the use of the goal-access-feedback-challenge-collaboration-fantasy (GAFCC-F) design model in online gamified classes. This mixed-method study examines the effects of exogenous and endogenous fantasies on student intrinsic motivation and course engagement. Study 1 was an exogenous fantasy embedded gamified online class where the plots and story have no association with the learning tasks on Moodle. Study 2 was an endogenous fantasy context where the plots could reflect the content of learning tasks. The results showed that the endogenous fantasy is more likely to improve student intrinsic motivation and course engagement than the exogenous fantasy context. Students immersed in the endogenous fantasy enjoyed doing the learning tasks more than the exogenous fantasy. Students' perceptions of both types of fantasy were also explored. Copyright © 2022 IEEE.