4 horas de terror con una simple actionscript?

  • neostart
  • Born
  • Born
  • No Avatar
  • Registrado: Mar 21, 2009
  • Mensajes: 1
  • Status: Offline

Nota Marzo 21st, 2009, 9:19 pm

Tengo un 35 piedras con las cartas 1 a 35.

El puede ser sólo el 7 piedras en una fila.

Cuento con 1 a 35 y el lugar de ellos, hasta tengo la piedra de 8, la cual debe ser colocado en la fila siguiente.

Si la posición de algunos de piedra es " x ", El número contado es" i "Y el ancho de la piedra es" w ",

decirme por favor, qué es la ecuación para restablecer la "x" de la piedra en particular y ser capaz de poner otro, a su lado.

Traté de construir la ecuación a mí mismo, pero sin éxito:

Código: [ Select ]
if (stone.x > 100) do

stone._x=0;

else

stone.x = stone.x + i * stone.width._width;
  1. if (stone.x > 100) do
  2. stone._x=0;
  3. else
  4. stone.x = stone.x + i * stone.width._width;



La clave es que quiero crear tablero de ajedrez de piedras, cuando sé, que sé que la "i" carta va desde 1 hasta 35.

Siempre me piedras clips posicionado como a continuación:

ooooooo
_______ooooooo
______________ooooooo

así, me perdí un poco la ecuación...
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Marzo 21st, 2009, 9:19 pm

  • nornholdj
  • Novice
  • Novice
  • Avatar de Usuario
  • Registrado: Mar 18, 2009
  • Mensajes: 18
  • Status: Offline

Nota Marzo 22nd, 2009, 10:38 am

Usar la funtion modulous en "i". Creo que usted desea utilizar:
Código: [ Select ]
if(stone.i%7 == 0)//this detects when you should jump to the next line
{
    //here you would want to reset stone.x to its starting position to reset the row
    //if 0 was your starting position
    stone._x = 0;

    //then increment the "y" value so that the next stone shows up on the next row
    //assuming that the height is the same as the width (like most chessboards)
    stone._y += stone._w;
    
    //you should have successfully positioned your first stone in the second row.
    //from here use the new "y" value for the rest of this row and then increment "x" by "w"
    //then for your next row this should be called again.
}
  1. if(stone.i%7 == 0)//this detects when you should jump to the next line
  2. {
  3.     //here you would want to reset stone.x to its starting position to reset the row
  4.     //if 0 was your starting position
  5.     stone._x = 0;
  6.     //then increment the "y" value so that the next stone shows up on the next row
  7.     //assuming that the height is the same as the width (like most chessboards)
  8.     stone._y += stone._w;
  9.     
  10.     //you should have successfully positioned your first stone in the second row.
  11.     //from here use the new "y" value for the rest of this row and then increment "x" by "w"
  12.     //then for your next row this should be called again.
  13. }


Esta declaración, si se colocan en una especie de lazo y que sólo detecta la primera piedra en una fila, pero todas las otras piedras que son relativas a uno.

Hágame saber si eso no tiene sentido. Yo no podría ser entendido correctamente.

Publicar Información

  • Total de mensajes en este tema: 2 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 43 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC