// varaibles
var follow_obj;
var kill_obj;
var current_speed;
follow_obj = TargetObj
kill_obj = HumanParent_obj
current_speed = 0
// set up move to target code
if (instance_exists(follow_obj))
{
mp_potential_settings(90,90,3,false);
mp_potential_step_object(follow_obj.x, follow_obj.y, 3, ZM1Obj);
direction = round(direction/90)*90;
current_speed = 3
if (distance_to_object(follow_obj) <= 2)
{
current_speed = 0
x = xprevious;
y = yprevious;
}
}
// set up move to human code
if (instance_exists(kill_obj))
{
if (distance_to_object(kill_obj) <= 20)
{
if !(collision_line(x,y,kill_obj.x,kill_obj.y,Wall_obj,false,true))
{
mp_potential_settings(90,90,3,false);
mp_potential_step_object(follow_obj.x, follow_obj.y, 3, ZM1Obj);
direction = round(direction/90)*90;
current_speed = 3
}
}
}
// set up movement system
if (current_speed > 0 )
{
if (direction >= 45 && direction < 135)
{
sprite_index = ZM1Up;
}
else if (direction >= 135 && direction < 225)
{
sprite_index = ZM1Left;
}
else if (direction >= 225 && direction < 315)
{
sprite_index = ZM1Down;
}
else
{
sprite_index = ZM1Right;
}
}
else
{
if (direction >= 45 && direction < 135)
{
sprite_index = ZM1UpStill;
}
else if (direction >= 135 && direction < 225)
{
sprite_index = ZM1LeftStill;
}
else if (direction >= 225 && direction < 315)
{
sprite_index = ZM1DownStill;
}
else
{
sprite_index = ZM1RightStill;
}
}
now to figure out collision coding and get my human hunter code working and my zombies will be done :D



Find content
Not Telling
