HTML File:
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="jquery.js"></script>
<div id="question">
<img id="fruit1" class="fruit">
</div>
I removed duplicates Separate file for explode effect. jquery.js not a jquery library sorry for the confusion
var playing = false;
var score;
var trialsleft;
var step;
var action;
var fruits = ["apple", "arbuzas", "avocado", "banana", "berry", "carrot", "lemon", "pumpkin", "tomato"]
$(function(){ // Click on start reset button
$("#startreset").click(function(){
// We are playing
if(playing == true) {
// Reload page
location.reload();
}else{
// We are not playing
playing = true; // Game initiated
// Set score to 0
score = 0;
$("#scorevalue").html(score);
// Show trials left
$("#trialsleft").show();
trialsleft = 3;
addHearts();
//Hide game over box
$("#gameover").hide();
// Change button text to reset game
$("#startreset").html("Reset Game");
// Start sending fruits
startAction();
}
});
$("#fruit1").mouseover(function(){
score++;
$("#scorevalue").html(score); //Update score
document.getElementById("sliceSound").play(); // Play Sound
// $("#sliceSound")[0].play();
//Stop Fruit
clearInterval(action);
//Hide Fruit
$("#fruit1").hide("explode", 500); // Slice fruits
//Send new fruit
setTimeout(startAction, 500);
});
I add top of my code, thanks for any help and support. I got functions below this code, but I'm not sure if it problem with that and should i post it here because it to long wont let me.