Hi,
how would i make a boss fight have multiple stages? I want to make it so when it reaches half hp it changes its sprite but so far i have had no luck.
The code i have is
obj_bossattack
x = owner.x;
y = owner.y+30;
//location of gun when assigned to sprite
if (instance_exists(obj_player))
{
if (obj_player.x <x) image_yscale = - image_yscale;
if (point_distance(obj_player.x,obj_player.y,x,y) <600)
{
image_angle = point_direction(x,y,obj_player.x,obj_player.y);
countdown --;
if (countdown <=0)
{
countdown = countdownrate;
with (instance_create_layer(x,y,"bullet",obj_bossattack))
speed = 10; //speed bullet travels
audio_play_sound(snd_boss_attack,5,false);
obj_bossattack.direction = image_angle + random_range(-3,3)
if (global.bosshp <=15)
{
image_index = 0;
}
else
{
image_index = 1;
}
}
}
}
I'm not very experienced in coding and this is my first time trying to do this so any help would be great
how would i make a boss fight have multiple stages? I want to make it so when it reaches half hp it changes its sprite but so far i have had no luck.
The code i have is
obj_bossattack
x = owner.x;
y = owner.y+30;
//location of gun when assigned to sprite
if (instance_exists(obj_player))
{
if (obj_player.x <x) image_yscale = - image_yscale;
if (point_distance(obj_player.x,obj_player.y,x,y) <600)
{
image_angle = point_direction(x,y,obj_player.x,obj_player.y);
countdown --;
if (countdown <=0)
{
countdown = countdownrate;
with (instance_create_layer(x,y,"bullet",obj_bossattack))
speed = 10; //speed bullet travels
audio_play_sound(snd_boss_attack,5,false);
obj_bossattack.direction = image_angle + random_range(-3,3)
if (global.bosshp <=15)
{
image_index = 0;
}
else
{
image_index = 1;
}
}
}
}
I'm not very experienced in coding and this is my first time trying to do this so any help would be great