elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.


Tema destacado:


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  Problema al tomar cartas.
0 Usuarios y 4 Visitantes están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Problema al tomar cartas.  (Leído 54 veces)
Tachikomaia


Desconectado Desconectado

Mensajes: 1.690


Hackentifiko!


Ver Perfil
Problema al tomar cartas.
« en: Hoy a las 14:32 »

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
  1. // para tomar otra carta: Crear función para distribuir cartas y agregar 1, en vez de agregar y redistribuir todas cuando ya están.
  2.  
  3. // Generar array de cartas:
  4. Cartas = [];
  5. Nro = 0;
  6. do {
  7. Nro++;
  8. Cartas[Cartas.length] = "P"+Nro;
  9. Cartas[Cartas.length] = "T"+Nro;
  10. Cartas[Cartas.length] = "C"+Nro;
  11. Cartas[Cartas.length] = "D"+Nro;
  12. } while (Nro < 13);
  13.  
  14. // Ordenarlas al azar:
  15. // Eso creo que no tiene que ver así que no lo pongo acá.
  16.  
  17. // Dar 2 a jugadores:
  18. SiguienteNroDeCarta = 0;
  19. CartasDeHumano = [];
  20. // Para facilitar las sumas:
  21. NumerosDeHumano = [];
  22. CartasDeIA = [];
  23. do {
  24. CartasDeHumano[CartasDeHumano.length] = Cartas[SiguienteNroDeCarta];
  25. NumerosDeHumano[NumerosDeHumano.length] = Number(Cartas[SiguienteNroDeCarta].substring(1, Cartas[SiguienteNroDeCarta].length));
  26. CartasDeIA[CartasDeIA.length] = Cartas[SiguienteNroDeCarta+1];
  27. SiguienteNroDeCarta = SiguienteNroDeCarta+2;
  28. } while (SiguienteNroDeCarta < 4);
  29.  
  30. // Mostrarlas en pantalla:
  31. function MostrarCartasDeHumano () {
  32. NroDeCartaaMostrar = 0;
  33. if (CartasDeHumano.length % 2 == 0) {
  34. PosicionDe0 = 256 - CartasDeHumano.length-1 * 50 - 25;
  35. } else {
  36. PosicionDe0 = 256 - CartasDeHumano.length * 50;
  37. }
  38. // trace(PosicionDe0);
  39. do {
  40. NombreDeCarta = "CartaDeHumano"+CartasDeHumano[NroDeCartaaMostrar];
  41. attachMovie ("sCarta", NombreDeCarta, NroDeCartaaMostrar);
  42. setProperty (NombreDeCarta, _x, PosicionDe0+(NroDeCartaaMostrar)*150);
  43. setProperty (NombreDeCarta, _y, 192);
  44. // Para el interior de la carta:
  45. // Eso creo que no tiene que ver así que no lo pongo acá.
  46. NroDeCartaaMostrar++;
  47. } while (NroDeCartaaMostrar < CartasDeHumano.length);
  48. }
  49. MostrarCartasDeHumano();
  50.  
  51. // Calcular suma de humano:
  52. // Eso creo que no tiene que ver así que no lo pongo acá.
  53.  
  54. // Calcular suma de IA:
  55. // Eso creo que no tiene que ver así que no lo pongo acá.
  56.  
  57. // Tomar carta sí o no. Un objeto en F2 repite esto:
  58. function TomarCartaSoN () {
  59. // Si se presiona izquierda:
  60. if (Key.isDown(37)) {
  61. // Eso creo que no tiene que ver así que no lo pongo acá.
  62. } else if (Key.isDown(39)) {
  63. SiguienteNroDeCarta++;
  64. CartasDeHumano[CartasDeHumano.length] = Cartas[SiguienteNroDeCarta];
  65. NumerosDeHumano[NumerosDeHumano.length] = Number(Cartas[SiguienteNroDeCarta].substring(1, Cartas[SiguienteNroDeCarta].length));
  66. Mensaje = "Has recibido "+CartasDeHumano[CartasDeHumano.length];
  67. MostrarCartasDeHumano();
  68. }
  69. }


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Problema al tomar un PID
Programación C/C++
Mr.Blue 2 2,661 Último mensaje 13 Junio 2010, 02:10 am
por Mr.Blue
Juego de cartas
Java
calun 6 5,792 Último mensaje 5 Mayo 2015, 18:57 pm
por DarK_FirefoX
Problema con float, no toman el valor que tienen que tomar
Programación C/C++
Naimaderis 1 1,880 Último mensaje 16 Diciembre 2016, 03:42 am
por engel lex
Problema mazo de cartas
Programación C/C++
makul 9 5,092 Último mensaje 5 Septiembre 2019, 21:15 pm
por K-YreX
cartas magi
Foro Libre
DJKENSHIN 6 4,002 Último mensaje 23 Octubre 2020, 23:20 pm
por Rvn4nt
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines