¿Cómo hago un sencillo juego de memoria?

Hola,

me gustaría hacer uno (o varios, por temas) juegos de memoria para que mis alumnos practiquen y aprendan vocabulario.

Tal y como recordaba, existe la posibilidad de hacerlos con javascript (así) pero no tengo el código para enredar (seguiré buscando) y además el resultado es un poco pobre... feo, la verdad.

He visto que existe también la posibilidad de hacerlo en flash, pero me he encontrado con un tutorial y veo que supera con mucho mis conocimientos, y más aún al no venir con un ejemplo al que yo pueda cambiar las imágenes y hacerlo rodar.

La idea es sencilla. No tiene porque tener más de un nivel de dificultad (aunque al menos tres estarían muy bien) y lo que quiero es hacer varios, según temas (la casa, la ropa, viajes...).

¿Alguien tiene idea de como puedo aprender o practicar para tener algo un poco resultón?

Muchas gracias ya por adelantado.
Pues tienes el Game Maker que es muy sencillo y en una tarde te enteras perfectamente de todo lo básico. Y si lo quieres aun mas sencillo (pero mucho eh xD) tienes el Multimedia Fusion 2

Los dos son de pago y las versiones trial están un poco limitadas en funcionalidad, pero igual para lo que quieres hacer te sobra.

Un saludo.
Pues voy a mirar a ver esos programas me dan la opción de hacer lo que quiero (parecen muy completos... no sé si complicados!)

Por ahora, he ido configurando el de javascript... bueno, no, sólo he hecho que me abra imágenes jpg y las tengo ahí, funciona. Pero es un tamaño muy grande de juego. Son 36... y eso me parece demasiado. Lo quiero más pequeño para ir por temas más específicos y si eso, ir yo ampliando.

¿Alguien me dice donde cambio el tamaño? He ido probando, pero no veo efecto en ninguna parte :-?
<!-- THREE STEPS TO INSTALL CONCENTRATION:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the onLoad event handler into the BODY tag
  3.  Put the last coding into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Brian Gosselin (bgaudiodr@aol.com) -->
<!-- Web Site:  http://www.bgaudiodr.iwarp.com -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var pics = new Array();
for (i = 0; i <= 18; i++) {
pics[i] = new Image();
pics[i].src = 'image' + i + '.jpg';
}
var map=new Array(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18);
var user = new Array();
var temparray = new Array();
var clickarray = new Array(0, 0);
var ticker, sec, min, ctr, id, oktoclick, finished;
function init() {
clearTimeout(id);
for (i = 0; i <= 35 ;i++) {
user[i] = 0;
}
ticker = 0;
min = 0;
sec = 0;
ctr = 0;
oktoclick = true;
finished = 0;
document.f.b.value = "";
scramble();
runclk();
for (i = 0; i <= 35; i++) {
document.f[('img'+i)].src = "image0.jpg";
   }
}
function runclk() {
min = Math.floor(ticker/60);
sec = (ticker-(min*60))+'';
if(sec.length == 1) {sec = "0"+sec};
ticker++;
document.f.b.value = min+":"+sec;
id = setTimeout('runclk()', 1000);
}
function scramble() {
for (z = 0; z < 5; z++) {
for (x = 0; x <= 35; x++) {
temparray[0] = Math.floor(Math.random()*36);
temparray[1] = map[temparray[0]];
temparray[2] = map[x];
map[x] = temparray[1];
map[temparray[0]] = temparray[2];
      }
   }
}
function showimage(but) {
if (oktoclick) {
oktoclick = false;
document.f[('img'+but)].src = 'image'+map[but]+'.jpg';
if (ctr == 0) {
ctr++;
clickarray[0] = but;
oktoclick = true;
} else {
clickarray[1] = but;
ctr = 0;
setTimeout('returntoold()', 600);
      }
   }
}
function returntoold() {
if ((clickarray[0] == clickarray[1]) && (!user[clickarray[0]])) {
document.f[('img'+clickarray[0])].src = "image0.jpg";
oktoclick = true;
} else {
if (map[clickarray[0]] != map[clickarray[1]]) {
if (user[clickarray[0]] == 0) {
document.f[('img'+clickarray[0])].src = "image0.jpg";
}
if (user[clickarray[1]] == 0) {
document.f[('img'+clickarray[1])].src = "image0.jpg";
   }
}
if (map[clickarray[0]] == map[clickarray[1]]) {
if (user[clickarray[0]] == 0&&user[clickarray[1]] == 0) { finished++; }
user[clickarray[0]] = 1;
user[clickarray[1]] = 1;
}
if (finished >= 18) {
alert('¡Conseguido! ¡Lo has hecho en '+document.f.b.value+' !');
init();
} else {
oktoclick = true;
      }
   }
}
//  End -->
</script>
</HEAD>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag  -->

<BODY OnLoad="init()">

<!-- STEP THREE: Copy this code into the BODY of your HTML document  -->

<center>
<h2>Concentración</h2>
<p>Busca las parejas entre estas imágenes de cosas de la casa.</p>
<form name="f">
<table cellpadding="0" cellspacing="0" border="0">
<script language="javascript">
<!-- Begin
for (r = 0; r <= 5; r++) {
document.write('<tr>');
for (c = 0; c <= 5; c++) {
document.write('<td align="center">');
document.write('<a href="javascript:showimage('+((6*r)+c)+')" onClick="document.f.b.focus()">');
document.write('<img src="image0.jpg" name="img'+((6*r)+c)+'" border="0">');
document.write('</a></td>');
}
document.write('</tr>');
}
// End -->
</script>
</table>
<br><br>
<input type="button" value="         " name="b" onClick="init()">
</form>
</center>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  3.63 KB -->
VozdeLosMuertos escribió:Pues voy a mirar a ver esos programas me dan la opción de hacer lo que quiero (parecen muy completos... no sé si complicados!)

Por ahora, he ido configurando el de javascript... bueno, no, sólo he hecho que me abra imágenes jpg y las tengo ahí, funciona. Pero es un tamaño muy grande de juego. Son 36... y eso me parece demasiado. Lo quiero más pequeño para ir por temas más específicos y si eso, ir yo ampliando.

¿Alguien me dice donde cambio el tamaño? He ido probando, pero no veo efecto en ninguna parte :-?

Añade alto y ancho a las imágenes (height y width), en esta línea:

document.write('<img src="image0.jpg" name="img'+((6*r)+c)+'" border="0" height="100" width="100">');


En este ejemplo que he puesto serían imágenes de 100 x 100 píxeles, puedes poner el tamaño que quieras.
Pues muchas gracias. Ahora ya caben todas las imágenes en la pantalla. :)

¿Un detalle, si en lugar de 36 imágenes quiero poner 24... qué tendría que cambiar?
Pues si no me he confundido, para 24 imágenes podría quedar así:

    <!-- THREE STEPS TO INSTALL CONCENTRATION:

      1.  Copy the coding into the HEAD of your HTML document
      2.  Add the onLoad event handler into the BODY tag
      3.  Put the last coding into the BODY of your HTML document  -->

    <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Original:  Brian Gosselin (bgaudiodr@aol.com) -->
    <!-- Web Site:  http://www.bgaudiodr.iwarp.com -->

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin
    var pics = new Array();
    for (i = 0; i <= 12; i++) {
    pics[i] = new Image();
    pics[i].src = 'image' + i + '.jpg';
    }
    var map=new Array(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12);
    var user = new Array();
    var temparray = new Array();
    var clickarray = new Array(0, 0);
    var ticker, sec, min, ctr, id, oktoclick, finished;
    function init() {
    clearTimeout(id);
    for (i = 0; i <= 23 ;i++) {
    user[i] = 0;
    }
    ticker = 0;
    min = 0;
    sec = 0;
    ctr = 0;
    oktoclick = true;
    finished = 0;
    document.f.b.value = "";
    scramble();
    runclk();
    for (i = 0; i <= 23; i++) {
    document.f[('img'+i)].src = "image0.jpg";
       }
    }
    function runclk() {
    min = Math.floor(ticker/60);
    sec = (ticker-(min*60))+'';
    if(sec.length == 1) {sec = "0"+sec};
    ticker++;
    document.f.b.value = min+":"+sec;
    id = setTimeout('runclk()', 1000);
    }
    function scramble() {
    for (z = 0; z < 5; z++) {
    for (x = 0; x <= 23; x++) {
    temparray[0] = Math.floor(Math.random()*24);
    temparray[1] = map[temparray[0]];
    temparray[2] = map[x];
    map[x] = temparray[1];
    map[temparray[0]] = temparray[2];
          }
       }
    }
    function showimage(but) {
    if (oktoclick) {
    oktoclick = false;
    document.f[('img'+but)].src = 'image'+map[but]+'.jpg';
    if (ctr == 0) {
    ctr++;
    clickarray[0] = but;
    oktoclick = true;
    } else {
    clickarray[1] = but;
    ctr = 0;
    setTimeout('returntoold()', 600);
          }
       }
    }
    function returntoold() {
    if ((clickarray[0] == clickarray[1]) && (!user[clickarray[0]])) {
    document.f[('img'+clickarray[0])].src = "image0.jpg";
    oktoclick = true;
    } else {
    if (map[clickarray[0]] != map[clickarray[1]]) {
    if (user[clickarray[0]] == 0) {
    document.f[('img'+clickarray[0])].src = "image0.jpg";
    }
    if (user[clickarray[1]] == 0) {
    document.f[('img'+clickarray[1])].src = "image0.jpg";
       }
    }
    if (map[clickarray[0]] == map[clickarray[1]]) {
    if (user[clickarray[0]] == 0&&user[clickarray[1]] == 0) { finished++; }
    user[clickarray[0]] = 1;
    user[clickarray[1]] = 1;
    }
    if (finished >= 12) {
    alert('¡Conseguido! ¡Lo has hecho en '+document.f.b.value+' !');
    init();
    } else {
    oktoclick = true;
          }
       }
    }
    //  End -->
    </script>
    </HEAD>

    <!-- STEP TWO: Insert the onLoad event handler into your BODY tag  -->

    <BODY OnLoad="init()">

    <!-- STEP THREE: Copy this code into the BODY of your HTML document  -->

    <center>
    <h2>Concentración</h2>
    <p>Busca las parejas entre estas imágenes de cosas de la casa.</p>
    <form name="f">
    <table cellpadding="0" cellspacing="0" border="0">
    <script language="javascript">
    <!-- Begin
    for (r = 0; r <= 5; r++) {
    document.write('<tr>');
    for (c = 0; c <= 3; c++) {
    document.write('<td align="center">');
    document.write('<a href="javascript:showimage('+((4*r)+c)+')" onClick="document.f.b.focus()">');
    document.write('<img src="image0.jpg" name="img'+((4*r)+c)+'" border="0" height="100" width="100">');
    document.write('</a></td>');
    }
    document.write('</tr>');
    }
    // End -->
    </script>
    </table>
    <br><br>
    <input type="button" value="         " name="b" onClick="init()">
    </form>
    </center>

    <p><center>
    <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>

    <!-- Script Size:  3.63 KB -->
Oye, muchas gracias!! Ahora que veo qué es lo que has cambiado, ya iré yo haciendo mis pruebas.

Así podré hacer un juego para cada parte de la casa, por ejemplo... y luego más general... guapo, jeje. En serio, muchas gracias!!! :p
Te recomiendo un programa que se llama JClic.

Saludos,
Ostia... con eso me acabas de abrir una puerta cojonuda, porque tenía en mente crear actividades pero no sabía de qué manera y... esto parece que con un poco de esfuerzo se pueden cosas útiles y con buen aspecto!!

Mil gracias!!
8 respuestas