Ayuda con el código de un juego de frases completas

  • dcg76_uamazc
  • Born
  • Born
  • No Avatar
  • Registrado: Abr 10, 2010
  • Mensajes: 1
  • Status: Offline

Nota Abril 10th, 2010, 9:56 pm

Hi, I `ma bit stuck, I` m making a game Where You Have to complete the sentences by dragging the words Which are dinamically generated over right place to STIs Some boxes, everything works fine But if you pull the words out of the pits Placed it all are one crashes.


Unfortunately this is someone elses code (another programmer WHO dance on us in the middle of the proyect) Although I Manage to make it work with new words, making the draggable items you undraggable one place all 4 of them in the boxes is totally right Unclear to me. I `ll appreciate any help I can get.


Here `s all the code That this part of the movie is using, I` m using cs4 with actionscript 2:

function random (min, max)
(
var _loc2 = true;
if (usados.length <= max - min)
(
while (_loc2! = false)
(
var _loc1 = Math.floor (Math.random () * (max - min + 1));
_loc2 = repeated (_loc1)
) / / End while
used. push (_loc1)
return (_loc1)
)
else
(
return (0);
) / / End else if
) / / End of the function
function repeat (num)
(
_loc1 var = false;
for (i = 0; i <usados.length; i + +)
(
if (num == used [i])
(
_loc1 = true;
) / / End if
) / / End of for
return (_loc1)
) / / End of the function
stop ();
var used = new Array ();
_root. palabras_colocadas = 0;
palabras_correctas = 0;
listado_x = 700;
listado_y = 400;
origenx = 0;
origeny = 0;
estaba_en = -1;
off = false;
_root.frase = 2;
var words = new Array ("huts", "made", "mud", "straw");
var correct = new Array (false, false, false, false);
var busy = new Array (-1, -1, -1, -1);
my_font var = new TextFormat ();
my_font.font = "Arial";
my_font.color = 0;
my_font. size = 30;
words [i]. embedFonts = true;
my_font.bold = true;
var i = 0;
while (i <4)
(
this ["box" + i]. gotoAndStop (1);
this.createEmptyMovieClip (myClip "+ i, this.getNextHighestDepth ());
length = words [i]. length * 22;
this ["myClip" + i]. createTextField ("label", 1, 0, 0, length, 40);
this ["myClip" + i]. label.text = words [i];
this ["myClip" + i]. label. setTextFormat (my_font)
this ["myClip" + i]. onPress = function ()
(
temp = this._name;
temp = Number (temp charAt (6));
if (occupied [0] == temp)
(
off = true;
estaba_en = 0;
) / / End if
if (occupied [1] == temp)
(
off = true;
estaba_en = 1;
) / / End if
if (occupied [2] == temp)
(
off = true;
estaba_en = 2;
) / / End if
if (occupied [3] == temp)
(
off = true;
estaba_en = 3;
) / / End if
if (! off)
(
estaba_en = -1;
) / / End if
origenx = this._x;
origeny = this._y;
trace ("was" + estaba_en)
this.startDrag ();
);
this ["myClip" + i]. onRelease = this ["myClip" + i]. onReleaseOutside = function ()
(
this.stopDrag ();
which = this._name;
which = Number (cual. charAt (6));
drop = eval (this._droptarget)
trace (drop);
where = String (drop);
frame = donde.substr (8, 6);
where = Number (donde. charAt (14));
trace (which + "in" + where + "" + table);
if (table == "table")
(
if (occupied [where]> = 0 & & occupied [where] <= 3 | | where == estaba_en)
(
off = false;
this._x = origenx;
this._y = origeny;
)
else
(
if (! off)
(
+ + _root.palabras_colocadas;
) / / End if
section = eval ("tranche" + (where + 1) + "_mc");
tramo.gotoAndPlay (2);
if (_root.palabras_colocadas> = 4)
(
startbtn.start ();
start_mc. gotoAndPlay (2);
)
else
(
palabra_ok.start ();
) / / End else if
length = words [which]. length * 8.500000E +000;
drop.gotoAndStop (2);
this._y = drop._y - 22;
this._x = drop. _x - long;
occupied [where] = is;
if (off)
(
off = eval ("Table" + estaba_en)
apaga.gotoAndStop (1);
= eval section ("section" + (estaba_en +1) + "_mc");
tranche. gotoAndPlay (6);
occupied [estaba_en] = -1;
correct [estaba_en] = false;
off = false;
trace ("is" + _root.palabras_colocadas + "words");
if (_root.palabras_colocadas == 3)
(
trace ("off without noise");
start_mc. gotoAndStop (1);
) / / End if
) / / End if
trace (occupied [0] + "" + occupied [1] + "" + occupied [2] + "" + occupied [3]);
if (which == where)
(
+ + Palabras_correctas;
correct [where] = true;
) / / End if
) / / End if
) / / End else if
if (table == "myClip" | | Table == "start_)
(
palabra_error.start ();
this._x = origenx;
this._y = origeny;
) / / End if
if (table == "bottom")
(
if (off)
(
off = eval ("Table" + estaba_en)
off. gotoAndStop (1);
= eval section ("section" + (estaba_en +1) + "_mc");
tramo.gotoAndPlay (6);
occupied [estaba_en] = -1;
correct [estaba_en] = false;
- _root. Palabras_colocadas;
off = false;
trace ("is" + _root.palabras_colocadas + "words");
if (_root. palabras_colocadas == 3)
(
startbtn.start ();
start_mc.gotoAndStop (1);
) / / End if
) / / End if
) / / End if
);
+ + I;
) / / End while
var ii = 0;
while (ii <4)
(
var numeroNuevo = random (1, 4);
trace (numeroNuevo)
this ["myClip" + numeroNuevo]. _x = listado_x;
this ['myClip "+ numeroNuevo]. listado_y + y = 40 * i;
+ + Ii;
) / / End while
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Abril 10th, 2010, 9:56 pm

Publicar Información

  • Total de mensajes en este tema: 1 mensaje
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 44 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