I'm new to web development and need to program quiz with sound,images and a lot of interactivity, and I just found that p5.js is the perfect solution for me.
My problem is that I have like more than 10 questions with different kind of inputs (each of them with their own rules and some with the same rules) and an introduction screen. And I really confused how can I organize this, how is the best way to keep my code clean, because the tutorials that I followed the usually do the examples in a single file, and I think that if I program something like this at the draw function ( if question == 1 { question, answers, Rules rules rules rules rules } if question == 2 {question, answers different rules rules } ) it will be an huge mess.
So, I need some solution for multiple-screens, but that share some global variables.The user should be able to back to any previous question already answered and modify the current answer.
I think that should be the same for a game with multiple levels, where you keep some "rules" of the world and just change the stages/levels/screens/enemies.
Sorry about my english, i hope that it si not confuse.
Thanks !