======================== ||== DECLARATIONS == ====================== var moleLoc = 1; var hammer = new Image(); hammer.src = "hammerTime.png"; var molePic = new Image(); molePic.src = "moleman.png"; var score = 0; var moleTime = 100; ======================== ||== PAINT == ====================== ==> 640 x 480 //Background stuff ctx.fillStyle = 'red' if(mx < 320 && my < 240){ //Quad 1 ctx.fillRect(0,0,320,240); }else if(mx > 320 && my < 240){ //Quad 2 ctx.fillRect(320, 0, 320,240); }else if(mx < 320 && my > 240){ //Quad 3 ctx.fillRect(0, 240, 320,240); }else if(mx > 320 && my > 240){ //Quad 4 ctx.fillRect(320, 240, 320,240); } if(moleLoc == 1) ctx.drawImage(molePic, 0,0,320,240); else if(moleLoc == 2) ctx.drawImage(molePic, 320,0,320,240); else if(moleLoc == 3) ctx.drawImage(molePic, 0,240,320,240); else if(moleLoc == 4) ctx.drawImage(molePic, 320,240,320,240); moleTimer = moleTimer - 1; if(moleTime <= 0){ moleLoc = Math.floor(Math.random()* 4) +1; moleTimer = 100; } ctx.drawImage(hammer, mx, my); ======================== ||== CLICK == ====================== if(mx < 320 && my < 240 && moleLoc == 1){ //Quad 1 score = score + 1; }else if(mx > 320 && my < 240 && moleLoc == 2){ //Quad 2 score = score + 1; }else if(mx < 320 && my > 240){ //Quad 3 if(moleLoc == 3) score = score + 1 }else if(mx > 320 && my > 240){ //Quad 4 if(moleLoc == 4) score = score + 1 } moleLoc = Math.floor(Math.random()* 4) +1;