Skip to content

Commit

Permalink
finish stage 5
Browse files Browse the repository at this point in the history
  • Loading branch information
devkennyy committed Aug 8, 2022
1 parent 7849c61 commit e9bf5f9
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion public/scripts/stages.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const stages = [
name: 'fa-bacon',
},
],
startDisabled: false,
startDisabled: true,
completed: false,
back: 4,
next: 6,
Expand Down Expand Up @@ -185,6 +185,9 @@ const handleStage = stageData => {
case 4:
handleStage4(stageData.id);
break;
case 5:
handleStage5(stageData.id);
break;
case 6:
handleStage6(stageData.id);
break;
Expand All @@ -210,6 +213,8 @@ const stageReset = stageData => {
$('#stage-icon').droppable('disable');
break;
case 5:
$('#stage-icon').css('opacity', '1');
$('#stage-icon').off('click');
break;
case 6:
$('#tileGroup').remove();
Expand Down Expand Up @@ -278,6 +283,22 @@ const handleStage4 = id => {
});
};

const handleStage5 = id => {
let totalClicksRequired = 3;
let clickCount = 1;
let opacityCalculator = 1;
$('#stage-icon').click(() => {
clickCount++;
opacityCalculator -= 1 / totalClicksRequired;
$('#stage-icon').css('opacity', `${opacityCalculator.toString()}`);
if (clickCount > totalClicksRequired) {
stages[id].completed = true;
enable('stage-btn-next');
}
});
};


const handleStage6 = id => {
// generates stage HTML
$('#stage_container').prepend($('<div>', { id: 'tileGroup' }));
Expand Down

0 comments on commit e9bf5f9

Please sign in to comment.