Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_viro_poison_effect_Step_0

(view raw script w/o annotations or w/e)
1
timer++;
2
var progress = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(timer / growtime, 2);
3
radius = lerp(minradius, maxradius, progress);
4
if (collision_circle(x, y, radius, obj_viro_needle, false, true))
5
{
6
    with (obj_viro_needle)
7
    {
8
        if (active == 0 || countdown > 0)
9
            continue;
10
        distance = distance_to_point(other.x, other.y);
11
        if (distance <= other.radius)
12
        {
13
            countdown = 1;
14
            flash = 4;
15
            spawnVirus = 1;
16
            spawning = false;
17
            d = instance_create(x, y, obj_animation_dx);
18
            d.sprite_index = spr_viro_poison_effect_big;
19
            d.image_angle = irandom(3) * 90;
20
            d.image_blend = other.color;
21
            d.image_xscale = 1;
22
            d.image_yscale = 1;
23
            d.depth = depth - 1;
24
        }
25
    }
26
}
27
if (radius >= nextradius)
28
{
29
    nextradius += 10;
30
    var c = radius * 2 * pi;
31
    var count = floor(c / 60) + 1;
32
    var startoffset = random(360);
33
    for (i = 0; i <= count; i++)
34
    {
35
        var dir = startoffset + ((360 / count) * i) + random_range(-180 / count, 180 / count);
36
        var len = radius + random_range(-5, 5);
37
        var xx = lengthdir_x(len, dir);
38
        var yy = lengthdir_y(len, dir);
39
        d = instance_create(xx + x, yy + y, obj_animation_dx);
40
        d.sprite_index = choose(spr_viro_poison_effect_a, spr_viro_poison_effect_b);
41
        d.image_angle = irandom(3) * 90;
42
        d.image_blend = color;
43
        d.image_alpha = 0.5;
44
        d.image_xscale = 1;
45
        d.image_yscale = 1;
46
    }
47
    if (timer >= growtime)
48
        instance_destroy();
49
}