I have been working on a Venn Diagram game using Html5, CSS3 and Javascript. The game consists of placing the correct answer in the correct zone on the venn diagram. I gave each zone in the diagram an id and told it which draggables to accept. I would like to evaluate the number of correctly placed elements and if all elements are correct show an image that says the score, if not all elements are placed correctly i want the wrong ones to be reverted back to their original position. Then allow the user to try ONCE more to answer the game, if the answers are wrong or right, again id like to show the picture with the score. Any idea how i can pull this off. Im new on stackoverflow and hope i am asking correctly.
<!-- Actividad a Realizar -->
<section class="imagenDrag hidden" id="contenido">
<div class="drag1" style="z-index: 1"><img src="images/elemento1.png" /></div>
<div class="drag2" style="z-index: 1"><img src="images/elemento2.png" /></div>
<div class="drag3" style="z-index: 1"><img src="images/elemento3.png" /></div>
<div class="drag4" style="z-index: 1"><img src="images/elemento4.png" /></div>
<div class="drag5" style="z-index: 1"><img src="images/elemento5.png" /></div>
<div class="drag6" style="z-index: 1"><img src="images/elemento6.png" /></div>
<div class="drag7" style="z-index: 1"><img src="images/elemento7.png" /></div>
<div class="drag8" style="z-index: 1"><img src="images/elemento8.png" /></div>
</section>
<hr class="cf hidden" id="hr1">
<!-- Imagen de Actividad Interactiva -->
<div class="hidden" id = "imagenJuego">
<div class="imagenDrop vennIzquierda dropIzquierda"><img src="images/vennizquierda.png" /></div>
<div class="imagenDrop vennCentro dropCentro"><img src="images/venncentro.png" /></div>
<div class="imagenDrop vennDerecha dropDerecha"><img src="images/vennderecha.png" /></div>
</div>
<!-- Imagen de Actividad Interactiva Fin -->
<!-- Actividad a Realizar Fin -->
<hr class="cf hidden" id="hr2">
<!-- Footer con boton de Verificacion -->
<footer>Conecta2 | Criterios para el manejo de la información
<button id="botonVerificar" class="hidden" ><a href="#">Verificar</a></button>
</footer>
<!-- Footer con boton de Verificacion Fin -->
</body>
</html>
JAVASCRIPT
$( init );
function init() {
$('.drag1, .drag2, .drag3, .drag4, .drag5, .drag6, .drag7, .drag8').draggable(); //todos los elementos son hechos draggable
};
$(function () {
$(".dropDerecha").droppable({
accept: ".drag1, .drag4, .drag6" //drags que acepta el lado derecho del diagrama
});
});
$(function () {
$(".dropIzquierda").droppable({
accept: ".drag2, .drag3, .drag7"//drags que acepta el lado izquierdo del diagrama
});
});
$(function () {
$(".dropCentro").droppable({
accept: ".drag8, .drag5" //drags que acepta el centro del diagrama
});
});
$(document).ready(function(){
$("#botonIniciar").click(function(){
$('#contenido, #imagenJuego, #botonVerificar, #ayuda, #instrucciones, #hr1, #hr2').removeClass('hidden');
$('#imagenInicio, #botonIniciar').addClass('hidden');
console.log('Haz Iniciado'); // boton que inicia el juego
});
});
// verificacion de resultados (si esta bien, nos da la evaluacion. si no esta bien regresa solo las erroneas a su posicion original para dar 1 intento mas para resolver, evaluando al final)
$(document).ready(function(){
$('#botonVerificar').click(function(){
console.log('Verificando');
});
});