Null-Z
Member
For my Boss object, I have a phase where it hovers over the player before dropping down. I want it to move back and forth around the player's X before dropping.
the problem?
it just float's away seemingly ignoring the conditions I set for it.
What am I misunderstanding?
Functioning code
the problem?
it just float's away seemingly ignoring the conditions I set for it.
Code:
//Sprites
sprite_index = spr_BearFangs;
//Counts
vspeed = 0
SeekTimer -= 1;
StuckTimer = 120;
//Conditions
if SeekTimer >= -240
{
if instance_exists(obj_Player)
{
if x > obj_Player.x
{
hspeed -= 0.3
}
if x < obj_Player.x
{
hspeed += 0.3
}
}
}
//State Transitions
if instance_exists(obj_Player)
{
if (SeekTimer <= 0) && (x = obj_Player.x)
{
hspeed = 0;
state = SnakeBoss_state.Drop;
}
}
if hp <= 0
{
state = SnakeBoss_state.death;
}
What am I misunderstanding?
Functioning code
Code:
//Sprites
sprite_index = spr_BearFangs;
//Counts
vspeed = 0
SeekTimer -= 1;
StuckTimer = 120;
//Conditions
if SeekTimer >= -600
{
if instance_exists(obj_Player)
{
var flip_distance = 50;
if (x > obj_Player.x + flip_distance)
{
hspeed -= 0.3;
if hspeed <= -5
{
hspeed = -5
}
}
else
if (x < obj_Player.x - flip_distance)
{
hspeed += 0.3;
if hspeed >=5
{
hspeed = 5
}
}
}
}
//State Transitions
if instance_exists(obj_Player)
{
if (SeekTimer <= 0) && (abs(x - obj_Player.x) < 2.00)
{
hspeed = 0;
state = SnakeBoss_state.Drop;
}
}
if hp <= 0
{
state = SnakeBoss_state.death;
}
Last edited: