// Increment counter on hit-box clickvarhitBox=document.querySelector('.hitbox');varincrementElement=document.getElementById('increment');// set the string to be an incrementable numberincrementElement.innerHTML=0;// reusable hitbox functionfunctionhitBoxHandler(e){if(incrementElement.innerHTML<2){e.preventDefault();incrementElement.innerHTML++;incrementElement.innerHTML=incrementElement.innerHTML;}else{// Go to the game over screengwd.actions.gwdPagedeck.goToPage('pagedeck','page1_2','none',0,'linear','top');incrementElement.innerHTML=0;//reset score to 0}}hitBox.addEventListener("click",hitBoxHandler);
varanywhereOnStage=document.getElementById('gwd-ad');// Mouse Down HandleranywhereOnStage.addEventListener("mousedown",function(e){e.preventDefault();this.classList.add('mouseDown');returnfalse;});// Mouse Up handleranywhereOnStage.addEventListener("mouseup",function(){this.classList.remove('mouseDown');});
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.