Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_growtangle_Step_0

(view raw script w/o annotations or w/e)
1
if (!init)
2
{
3
    if (visible && (maxxscale != 2 || maxyscale != 2) && sprite_index == spr_battlebg_0)
4
    {
5
        customBox = true;
6
        if ((maxxscale % 1) != 0)
7
            maxxscale = round(maxxscale * 37.5) / 37.5;
8
        if ((maxyscale % 1) != 0)
9
            maxyscale = round(maxyscale * 37.5) / 37.5;
10
        var _tempxscale = maxxscale / 2;
11
        var _tempyscale = maxyscale / 2;
12
        var surf = surface_create(75 * _tempxscale, 75 * _tempyscale);
13
        surface_set_target(surf);
14
        draw_clear_alpha(c_black, 0);
15
        draw_sprite_ext(spr_battlebg_stretch, 0, 37 * _tempxscale, 37 * _tempyscale, _tempxscale, _tempyscale, 0, c_white, 1);
16
        spr_custom_box = sprite_create_from_surface(surf, 0, 0, 75 * _tempxscale, 75 * _tempyscale, false, false, round(37.5 * _tempxscale), round(37.5 * _tempyscale));
17
        sprite_index = spr_battlebg_stretch_hitbox;
18
        surface_reset_target();
19
        surface_free(surf);
20
    }
21
    init = 1;
22
}
23
growth = 0;
24
if (timer < maxtimer && growcon == 1)
25
    growth = 1;
26
if (timer > 0 && growcon == 3)
27
    growth = 1;
28
if (growth == 1)
29
{
30
    if (growcon == 1)
31
        timer += 1;
32
    if (growcon == 3)
33
        timer -= 1;
34
    image_xscale = maxxscale * (timer / maxtimer);
35
    image_yscale = maxyscale * (timer / maxtimer);
36
    image_angle = 180 + (180 * (timer / maxtimer)) + target_angle;
37
    image_alpha = 0.5 + ((timer / maxtimer) * 0.5);
38
    if (visible)
39
    {
40
        d = instance_create(x, y, obj_afterimage);
41
        d.sprite_index = spr_custom_box;
42
        d.image_xscale = image_xscale / (maxxscale / 2);
43
        d.image_yscale = image_yscale / (maxyscale / 2);
44
        d.image_angle = image_angle;
45
        d.depth = depth - 1;
46
        d.image_blend = image_blend;
47
        d.image_alpha = (1 - image_alpha) + 0.1;
48
        d.image_speed = 0;
49
    }
50
    if (timer >= maxtimer && growcon == 1)
51
    {
52
        growcon = 2;
53
        image_angle = target_angle;
54
    }
55
    if (timer <= 0 && growcon == 3)
56
        instance_destroy();
57
}