Julio 11, 2014, 07:32:38 PM Ultima modificación: Julio 12, 2014, 10:35:58 PM por Chrom
Hola a todos estoy haciendo un juego de plataformas en  :GM8: y en el jefe final es un sprite de 3 imagenes y 2 que no se usaran en el juego xd ,entonces por cada fase del jefe hay un sprite y cuando llega a la fase numero 3 el jefe deberia seguir un Path tengo una duda miren mi codigo :
En create:
[spoiler]
image_speed=0;
image_index=0;
hitpoints=2000;
global.phase = 1;
switching = false;
path = false;
[/spoiler]
En Step :
[spoiler]
if hitpoints <= 1000 {global.phase = 2;}
if hitpoints <= 32 {global.phase = 3;}

if global.phase == 2 {image_index = 1;}
if global.phase == 3 {image_index = 2;}

if global.phase == 1 {
if switching == false
   {
   hspeed = 2.5;
   switching = true;
   }
   if floor(random(50)) < 1
   {
   instance_create(x,y,obj_meteorito);
   }
   if x >= 592 {hspeed = -2.5}
    if x <= 48 {hspeed = 2.5}
}
if global.phase == 2 {

   if switching == false
   {
   hspeed = 5;
   switching = true;
   }
   if floor(random(20)) < 1
   {
   instance_create(x,y,obj_meteorito);
   }
   if x >= 592 {hspeed = -5}
    if x <= 48 {hspeed = 5}
}

if global.phase == 3
{
    if switching == true {
   move_towards_point(64,64,10)
    }
   if x <= 64 && y <= 64 {switching = false;}
   
       if switching==false {speed=0;}
   
    if switching==false && path==false{path_start(pth1, 10, 0,false) path = true;{
    if path_end{
    instance_create(x,y,object27)
    instance_create(x,y,explosion)
    instance_destroy()}   
    }   
}
}
[/spoiler]
y mi duda es que el path no se ejecuta el jefe se va para la izquierda y explota, y deberia hacer el path y explotar

   if switching==false && path==false{path_start(pth1, 10, 0,false) path = true;{
    if path_end{
    instance_create(x,y,object27)
    instance_create(x,y,explosion)
    instance_destroy()}   
    }   
}
}

En la parte resaltada pones que si path es falso que el enemigo empieze a usar el path para moverse, pero enseguida pones path=true o sea que se cancela la orden de usar el path, me parece que el error esta ahi.