0
the console returns the variable as Undefined
carta = new Image();
carta.src = "images/CartaVirada.png";
carta.src2 = defineCarta(1);
carta.position = {x:5, y:10};
carta.numImg = criarAleatorioUnico();
function defineCarta(numCarta)
{
if(numCarta == 1)
{
if (carta.numImg == 1 | carta.numImg == 2 ) return "images/Carta1.png";
else
{
if (carta.numImg == 3 | carta.numImg == 4 ) return "images/Carta2.png";
else
{
if (carta.numImg == 5 | carta.numImg == 6 ) return "images/Carta3.png";
else
{
if (carta.numImg == 7 | carta.numImg == 8 ) return "images/Carta4.png";
}
}
}
That’s right, thank you very much.
– Gabriel Camargo