Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_shutta_rotation_attack_Step_0

(view raw script w/o annotations or w/e)
1
if (!init || con == -1)
2
{
3
    if (!init)
4
    {
5
        with (obj_dbulletcontroller)
6
            ratio = 1;
7
    }
8
    if (difficulty >= 2)
9
    {
10
        freeze = false;
11
        motion_blur = true;
12
        var _xrel = irandom_range(-1, 1);
13
        var _yrel = irandom_range(-1, 1);
14
        var _fixed_target = false;
15
        if (attacktype == 77)
16
        {
17
            pivotx = obj_growtangle.x + -50;
18
            pivoty = obj_growtangle.y;
19
            _fixed_target = true;
20
            targetx = obj_growtangle.x;
21
            targety = obj_growtangle.y + (50 * rotSign);
22
            edit_time = 30;
23
            lerp_time = 30;
24
            if (difficulty != 4)
25
                other_controller.swing = 12;
26
            if (difficulty >= 2)
27
                other_controller.special = 4;
28
            if (difficulty >= 3)
29
                controller.rate = 90;
30
        }
31
        else if (attacktype == 147)
32
        {
33
            pivotx = obj_growtangle.x + (_xrel * 75);
34
            pivoty = obj_growtangle.y + (_yrel * 75);
35
            with (obj_dbulletcontroller)
36
                btimer = 0;
37
        }
38
        else if (attacktype == 145)
39
        {
40
            pivotx = obj_growtangle.x;
41
            pivoty = obj_growtangle.y;
42
        }
43
        else
44
        {
45
            pivotx = obj_growtangle.x + (_xrel * 50);
46
            pivoty = obj_growtangle.y + (_yrel * 50);
47
        }
48
        x = pivotx;
49
        y = pivoty;
50
        if (!_fixed_target)
51
        {
52
            if (_xrel == 0 && _yrel == 0)
53
            {
54
                targetx = obj_growtangle.x + choose(-50, 50);
55
                targety = obj_growtangle.y + choose(-50, 50);
56
            }
57
            else
58
            {
59
                targetx = obj_growtangle.x - choose(0, _xrel * 50);
60
                targety = obj_growtangle.y - choose(0, _yrel * 50);
61
            }
62
        }
63
    }
64
    if (difficulty == 1)
65
    {
66
        shotsize += 40;
67
        padding += 20;
68
    }
69
    if (difficulty >= 3)
70
        multiple = true;
71
    if (multiple && !special_timing)
72
    {
73
        edit_time = 20;
74
        wait_time = 5;
75
    }
76
    if (motion_blur)
77
        alarm[0]
 -= afterimage_count * afterimage_interval;
gml_Object_obj_shutta_rotation_attack_Alarm_0.gml

if (con == 0 && motion_blur && afterimage_index < afterimage_count) { with (obj_collidebullet) { var _afim = instance_create(x, y, obj_bulletparent);
scr_image_copy(_afim, self);
_afim.image_alpha = 0; _afim.saved_alpha = ((other.afterimage_index + 1) / other.afterimage_count) * 0.4; afterimage[other.afterimage_index] = _afim; afterimage[other.afterimage_index].image_speed = 0; } afterimage_index++; alarm[0]
 = afterimage_interval;
} else { con++; } if (con == 1) { take_photo = true; if (multiple) alarm[0]
 = 10;
else alarm[0]
 = 15;
} if (con == 2 && difficulty >= 1) { if (difficulty >= 4) lerp_time = edit_time; if (difficulty >= 3) alarm[0]
 = edit_time;
else alarm[0]
 = random_range(20, 50);
} if (con == 3) alarm[0]
 = wait_time;
if (con == 4) event_user(1);
78
    init = true;
79
}
80
if (handlerp < 1 && con < 3)
81
{
82
    handlerp += (1/15);
83
    var _handease = 
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; } }
(handlerp, 2);
84
    hand_a.x = (x - (75 * rotSign)) + (lerp(-80, -padding - 5, _handease) * rotSign);
85
    hand_a.y = (y - 75) + lerp(-80, -padding - 5, _handease);
86
    hand_a.image_alpha = handlerp / 2;
87
    hand_b.x = x + (75 * rotSign) + (lerp(80, padding + 5, _handease) * rotSign);
88
    hand_b.y = y + 75 + lerp(80, padding + 5, _handease);
89
    hand_b.image_alpha = handlerp / 2;
90
}
91
if (con == 2 || con == 3)
92
    event_user(2);
93
if (con == 4)
94
{
95
    with (border)
96
    {
97
        if (image_alpha > 0)
98
            image_alpha = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(image_alpha, 0, 0.1);
99
    }
100
    if (handlerp < 2)
101
    {
102
        handlerp += (1/15);
103
        var _handease = 
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; } }
(handlerp - 1, 3);
104
        var _baserot_a = rotation + 90;
105
        var _baserot_b = rotation - 90;
106
        hand_a.x = pivotx + lengthdir_x(lerp(hand_a_dist, hand_a_dist + 20, _handease), _baserot_a + (45 * rotSign));
107
        hand_a.y = pivoty + lengthdir_y(lerp(hand_a_dist, hand_a_dist + 20, _handease), _baserot_a + (45 * rotSign));
108
        if (multiple)
109
            hand_a.image_alpha = 1 - (handlerp - 1);
110
        hand_b.x = pivotx + lengthdir_x(lerp(hand_b_dist, hand_b_dist + 20, _handease), _baserot_b + (45 * rotSign));
111
        hand_b.y = pivoty + lengthdir_y(lerp(hand_b_dist, hand_b_dist + 20, _handease), _baserot_b + (45 * rotSign));
112
        hand_b.image_alpha = 1 - (handlerp - 1);
113
        if (handlerp >= 2)
114
            instance_destroy();
115
    }
116
}