Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_darkshape_blast_Step_1

(view raw script w/o annotations or w/e)
1
var doend = false;
2
coolsize *= 0.8;
3
repeat (5)
4
{
5
    image_angle = direction;
6
    var afterimage = 
scr_afterimage_grow
scr_afterimage_grow

function
scr_afterimage_grow()
{ afterimage = instance_create(x, y, obj_afterimage_grow); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; afterimage.image_alpha = image_alpha; return afterimage; }
();
7
    with (afterimage)
8
    {
9
        fade = 0;
10
        xrate = 0;
11
        yrate = -0.2;
12
    }
13
    x += lengthdir_x(spd / 5, direction);
14
    y += lengthdir_y(spd / 5, direction);
15
    var anglediff = angle_difference(direction, point_direction(x, y, hx, hy));
16
    direction -= clamp(sign(anglediff) * tracking_val, -abs(anglediff), abs(anglediff));
17
    tracking_val = 
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; }
(tracking_val, 5, 0.5);
18
    if (point_distance(x, y, hx, hy) < 6)
19
    {
20
        doend = true;
21
        break;
22
    }
23
}
24
if (doend)
25
{
26
    image_angle = direction;
27
    var afterimage = 
scr_afterimage_grow
scr_afterimage_grow

function
scr_afterimage_grow()
{ afterimage = instance_create(x, y, obj_afterimage_grow); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; afterimage.image_alpha = image_alpha; return afterimage; }
();
28
    snd_play(snd_explosion_firework_bc);
29
    with (afterimage)
30
    {
31
        fade = 0;
32
        xrate = 0;
33
        yrate = -0.2;
34
    }
35
    with (
scr_afterimage_grow
scr_afterimage_grow

function
scr_afterimage_grow()
{ afterimage = instance_create(x, y, obj_afterimage_grow); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; afterimage.image_alpha = image_alpha; return afterimage; }
())
36
    {
37
        x = other.hx;
38
        y = other.hy;
39
        sprite_index = spr_darkshape_blast_impact;
40
        image_xscale = 2;
41
        image_yscale = 2;
42
        image_angle = irandom(360);
43
        fade = 0;
44
        xrate = -0.4;
45
        yrate = -0.4;
46
    }
47
    repeat (8 + irandom(8))
48
    {
49
        with (instance_create_depth(x + random_range(-12, 12), y + random_range(-12, 12), depth + 2, obj_particle_generic))
50
        {
51
            image_xscale *= (1 + random(3));
52
            image_blend = c_white;
53
            direction = point_direction(other.x, other.y, other.xprevious, other.yprevious) + random_range(-60, 60);
54
            image_angle = direction;
55
            speed = 12 + random(16);
56
            acceleration_type = 1;
57
            shrink_rate = 0.1 + random(0.1);
58
            acceleration_rate = 0.9 - random(0.1);
59
        }
60
    }
61
    instance_destroy();
62
}