Código [Seleccionar]
//Detectar Al Player
if (distance_to_object(objPlayer)<14.8) and (!Muerto[0]) {
Muerto[0] = true;
}
//Disparar
if Muerto[0] == false {
timer++;
if timer == 1
{
a = instance_create(x,y-15,objSoldado00_Bala);
a.hspeed = 4*image_xscale;
sprite_index = sprSoldado00_Disparando;
image_speed = 0.5;
}
if timer == 11
{
sprite_index = sprSoldado00_Stand;
image_index = 0;
}
if timer == 21
{
a = instance_create(x,y-15,objSoldado00_Bala);
a.hspeed = 4*image_xscale;
sprite_index = sprSoldado00_Disparando;
image_speed = 0.5;
}
if timer == room_speed*2 {timer = 0;}
} else if Muerto[0] == true {timer = -1;with (a) {instance_destroy();} }
//Cambiar el xscale
if (!Sellado) {
if instance_exists(objPlayer) and Muerto[0] == false {
if objPlayer.x<x {xscale = -1;}
if objPlayer.x>x {xscale = 1 ; }
}
}
if Muerto[1] == true {image_xscale = xscale*-1;}
image_xscale = xscale;
//Muerte animation
if Muerto[0] == true {
sprite_index = sprSoldado00_Muerte;
if timer2 == 0 {image_speed = 0.2;}
}
if Muerto[1] == true {
timer2++;
image_speed = 0;
if timer2 == 3 {image_alpha = 0;}
if timer2 == 6 {image_alpha = 1;}
if timer2 == 9 {image_alpha = 0;}
if timer2 == 12 {image_alpha = 1;}
if timer2 == 15 {image_alpha = 0;timer2 = -1;instance_destroy();}
}
En las expresiones de "if" he puesto"==". Este símbolo "==" sirve para hacer comparaciones. Es como decir si una variable es exactamente igual a un valor. Un solo "=" es para asignar valores. Espero se solucione el problema.