Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_cornerpendulumbullet_Step_0

(view raw script w/o annotations or w/e)
1
image_alpha += 0.1;
2
if (image_alpha == 1.5)
3
    active = 1;
4
var _shaftdir = point_direction(x, y, swingpoint_x, swingpoint_y);
5
var _accel, _swingdir;
6
switch (vertical_mirroring)
7
{
8
    case 1:
9
        if (_shaftdir < 90 || _shaftdir > 270)
10
            _swingdir = _shaftdir - 90;
11
        else
12
            _swingdir = _shaftdir + 90;
13
        _accel = lengthdir_y(0.5, _swingdir);
14
        break;
15
    case -1:
16
        if (_shaftdir < 90 || _shaftdir > 270)
17
            _swingdir = _shaftdir + 90;
18
        else
19
            _swingdir = _shaftdir - 90;
20
        _accel = -lengthdir_y(0.5, _swingdir);
21
        break;
22
}
23
hspeed += lengthdir_x(_accel, _swingdir);
24
vspeed += lengthdir_y(_accel, _swingdir);
25
if (_swingdir < (direction - 180))
26
    _swingdir += 360;
27
if (_swingdir > (direction + 180))
28
    _swingdir -= 360;
29
if (direction > (_swingdir - 90) && direction < (_swingdir + 90))
30
    direction = _swingdir;
31
else
32
    direction = _swingdir - 180;
33
x = swingpoint_x - lengthdir_x(swingdistance, _shaftdir);
34
y = swingpoint_y - lengthdir_y(swingdistance, _shaftdir);
35
image_angle = point_direction(swingpoint_x, swingpoint_y, x, y) + 90;
36
if ((x >= swingtarget_x && (direction > 330 || direction < 30)) || (x <= swingtarget_x && direction > 150 && direction < 210))
37
{
38
    x = swingtarget_x;
39
    y = swingtarget_y;
40
    with (obj_growtangle)
41
    {
42
        var _box = instance_create_depth(x, y, depth, obj_growtanglebellshake);
43
        _box.image_xscale = image_xscale;
44
        _box.image_yscale = image_yscale;
45
        _box.image_alpha = image_alpha;
46
        _box.splash_x = other.x;
47
        _box.splash_y = other.y;
48
        visible = false;
49
    }
50
    instance_destroy();
51
}