Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_bqueen_missle_homing_Step_0

(view raw script w/o annotations or w/e)
1
image_angle = direction - 90;
2
if (instance_exists(obj_heart))
3
    idealdir = point_direction(x, y, obj_heart.x + 10, obj_heart.y + 10);
4
else
5
    instance_destroy();
6
vspeed += lengthdir_y(homingfactor, idealdir);
7
hspeed += lengthdir_x(homingfactor, idealdir);
8
if (speed > 10)
9
    speed = 10;
10
homingfactor = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(homingfactor, maxhomingfactor, 0.2);
11
timer++;
12
if (timer >= 12)
13
    maxhomingfactor = 0.3;
14
if (timer >= 60)
15
    instance_destroy();
16
if (global.turntimer < 3)
17
    instance_destroy();