//get camera position
global.cw = camera_get_view_width(o_camera.camera);
global.ch = camera_get_view_height(o_camera.camera);
global.cx = camera_get_view_x(o_camera.camera);
global.cy = camera_get_view_y(o_camera.camera);
if instance_exists(o_target) and !on_screen(o_target, 10) {
//set obj to middle of view
x = cx + cw/2;
y = cy + ch/2;
//get angle to object
var angle_to_obj = point_direction(x ,y , o_target.x, o_target.y);
//start at the furthest point we can, which is half the view height
x = x + lengthdir_x(ch/2, angle_to_obj);
y = y + lengthdir_y(ch/2, angle_to_obj);
//move until we are no longer on screen
while on_screen(id, 10) {
x = x + lengthdir_x(1, angle_to_obj);
y = y + lengthdir_y(1, angle_to_obj);
}
//draw arrow
draw_sprite_ext(o_arrow, 0, x, y, 1, 1, angle_to_obj + 90, -1, 1);
}