Guide by Pvic
Put this in obj_character's "actions" code in the Step event
// Find nearest enemy object. var _dummy; //_dummy = instance_nearest(x, y, par_enemy); if (animation_direction == 1) { _dummy = scr_instance_nearest_dir_x(x, y, par_enemy, ">=") }else { _dummy = scr_instance_nearest_dir_x(x, y, par_enemy, "<="); } if(_dummy) { global.target = _dummy; // Home on to one enemy at a time. Prevents changing targets mid-homing attack. var _dir, _dist; _dir = point_direction(x, y, global.target.x, global.target.y); _dist = distance_to_object(global.target); if (_dist < homing_dist && !collision_line(x, y, global.target.x, global.target.y, par_terrain, true, false) && !collision_line(x, y, global.target.x, global.target.y, par_layer_low, true, false) && !collision_line(x, y, global.target.x, global.target.y, par_layer_high, true, false) ) { global.target=global.target }else { global.target = noone; // Reset homing object in case something happens to the target. } }Put this in obj_hud's create event:
_dist=0;global.target=noone;And put this in the draw event
if instance_exists(global.target){if global.target!=noone && (!global.main_player.ground && (global.main_player.action == ConActNormal || global.main_player.action == ConActJump || global.main_player.action==ConActSpring || global.main_player.action==ConActHoming)){draw_sprite(sprTarget,1,global.target.x,global.target.y)}}make a sprite called sprTarget and center the offset https://cdn.discordapp.com/attachments/403203277568606219/409748270768848906/sprTarget_strip4.png