Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_growtangle_Step_0

related scripts: Create_0Destroy_0Draw_0Other_5Step_0 Step_2

(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) || box_function)
4
    {
5
        customBox = true;
6
        sprite_index = spr_battlebg_stretch_hitbox;
7
        if ((maxxscale % 2) != 0)
8
            maxxscale = round(maxxscale * 37.5) / 37.5;
9
        if ((maxyscale % 2) != 0)
10
            maxyscale = round(maxyscale * 37.5) / 37.5;
11
        image_xscale = maxxscale / 2;
12
        image_yscale = maxyscale / 2;
13
        var _tempxscale = sprite_width;
14
        var _tempyscale = sprite_height;
15
        if (box_function)
16
        {
17
            box_function();
18
        }
19
        else
20
        {
21
            var surf = surface_create(sprite_width, sprite_height);
22
            surface_set_target(surf);
23
            draw_clear_alpha(c_black, 0);
24
            draw_sprite_ext(spr_battlebg_stretch, 0, sprite_xoffset, sprite_yoffset, image_xscale, image_yscale, 0, c_white, 1);
25
            spr_custom_box = sprite_create_from_surface(surf, 0, 0, sprite_width, sprite_height, false, false, sprite_xoffset, sprite_yoffset);
26
            sprite_index = spr_battlebg_stretch_hitbox;
27
            surface_reset_target();
28
            surface_free(surf);
29
        }
30
    }
31
    init = 1;
32
}
33
growth = 0;
34
if (timer < maxtimer && growcon == 1)
35
    growth = 1;
36
if (timer > 0 && growcon == 3)
37
    growth = 1;
38
if (growth == 1)
39
{
40
    if (growcon == 1)
41
        timer += 1;
42
    if (growcon == 3)
43
        timer -= 1;
44
    sizer = timer / maxtimer;
45
    image_xscale = maxxscale * sizer;
46
    image_yscale = maxyscale * sizer;
47
    image_angle = 180 + (180 * (timer / maxtimer)) + target_angle;
48
    image_alpha = 0.5 + ((timer / maxtimer) * 0.5);
49
    if (visible)
50
    {
51
        d = instance_create(x, y, obj_afterimage);
52
        d.sprite_index = spr_custom_box;
53
        var _scale = sizer * growscale;
54
        d.image_xscale = _scale;
55
        d.image_yscale = _scale;
56
        d.image_angle = image_angle;
57
        d.depth = depth - 1;
58
        d.image_blend = image_blend;
59
        d.image_alpha = (1 - image_alpha) + 0.1;
60
        d.image_speed = 0;
61
    }
62
    if (timer >= maxtimer && growcon == 1)
63
    {
64
        growcon = 2;
65
        image_angle = target_angle;
66
    }
67
    if (timer <= 0 && growcon == 3)
68
        instance_destroy();
69
}