Problema al tomar cartas.
(1/1)
Tachikomaia:
En el siguiente video notarán varios errores pero céntrense en la posición de las cartas, estoy diciendo al juego que me de otra y otra, etc, y debería mostrarlas mejor posicionadas (las cartas, los símbolos en ellas son otro tema) ¿cómo lo logro?
https://youtu.be/o0IiQwvmSOY
Código
// para tomar otra carta: Crear función para distribuir cartas y agregar 1, en vez de agregar y redistribuir todas cuando ya están.
// Generar array de cartas:
Cartas = [];
Nro = 0;
do {
Nro++;
Cartas[Cartas.length] = "P"+Nro;
Cartas[Cartas.length] = "T"+Nro;
Cartas[Cartas.length] = "C"+Nro;
Cartas[Cartas.length] = "D"+Nro;
} while (Nro < 13);
// Ordenarlas al azar:
// Eso creo que no tiene que ver así que no lo pongo acá.
// Dar 2 a jugadores:
SiguienteNroDeCarta = 0;
CartasDeHumano = [];
// Para facilitar las sumas:
NumerosDeHumano = [];
CartasDeIA = [];
do {
CartasDeHumano[CartasDeHumano.length] = Cartas[SiguienteNroDeCarta];
NumerosDeHumano[NumerosDeHumano.length] = Number(Cartas[SiguienteNroDeCarta].substring(1, Cartas[SiguienteNroDeCarta].length));
CartasDeIA[CartasDeIA.length] = Cartas[SiguienteNroDeCarta+1];
SiguienteNroDeCarta = SiguienteNroDeCarta+2;
} while (SiguienteNroDeCarta < 4);
// Mostrarlas en pantalla:
function MostrarCartasDeHumano () {
NroDeCartaaMostrar = 0;
if (CartasDeHumano.length % 2 == 0) {
PosicionDe0 = 256 - CartasDeHumano.length-1 * 50 - 25;
} else {
PosicionDe0 = 256 - CartasDeHumano.length * 50;
}
// trace(PosicionDe0);
do {
NombreDeCarta = "CartaDeHumano"+CartasDeHumano[NroDeCartaaMostrar];
attachMovie ("sCarta", NombreDeCarta, NroDeCartaaMostrar);
setProperty (NombreDeCarta, _x, PosicionDe0+(NroDeCartaaMostrar)*150);
setProperty (NombreDeCarta, _y, 192);
// Para el interior de la carta:
// Eso creo que no tiene que ver así que no lo pongo acá.
NroDeCartaaMostrar++;
} while (NroDeCartaaMostrar < CartasDeHumano.length);
}
MostrarCartasDeHumano();
// Calcular suma de humano:
// Eso creo que no tiene que ver así que no lo pongo acá.
// Calcular suma de IA:
// Eso creo que no tiene que ver así que no lo pongo acá.
// Tomar carta sí o no. Un objeto en F2 repite esto:
function TomarCartaSoN () {
// Si se presiona izquierda:
if (Key.isDown(37)) {
// Eso creo que no tiene que ver así que no lo pongo acá.
} else if (Key.isDown(39)) {
SiguienteNroDeCarta++;
CartasDeHumano[CartasDeHumano.length] = Cartas[SiguienteNroDeCarta];
NumerosDeHumano[NumerosDeHumano.length] = Number(Cartas[SiguienteNroDeCarta].substring(1, Cartas[SiguienteNroDeCarta].length));
Mensaje = "Has recibido "+CartasDeHumano[CartasDeHumano.length];
MostrarCartasDeHumano();
}
}
Navegación