I'm new to programming. I want to make a game where the user encounters a problem and then chooses one of 2-3 options. Currently, I have the story/content in html and handle the events using javascript/jquery. Is this an acceptable way or should I put the content in main.js or a separate .js file?
I will be writing a lot of the story. My concern is that if I want to edit the content, I don't want it to affect other elements.
In other words, what would be the most efficient way in handling this?
Right now I'm moving from div to div as the user clicks a button. That's pretty much the foundation of the game.
index.html
<div class="status" data-status="start">
<p>Let's start!</p>
<!--buttons for user choices-->
<input type="button" class="option" value="- I'm ready!" data-target="task1">
<input type="button" class="option" value="- I'm not ready!" data-target="no_task">
</div>
<div class="status" data-status="task1">
<p>Here's what you have to do. (More story...)</p>
<input type="button" class="option" value="- I'm done. What's next?" data-target="task2">
</div>
main.js
var $allStatuses= $('.status');
var $allOptions = $('.option');
$('.option').on('click', function() {
var targetName = $(this).data('target');
var $target = $('.situation[data-status="' + targetName + '"]');
if($target.length === 1) {
$allStatuses.hide();
$allOptions.hide();
$target.fadeIn('slow');
$allOptions.fadeIn('slow');
}
});