Undertale script viewer

← back to main script listing

gml_Object_obj_mettheart_4_Step_0

(view raw script w/o annotations or w/e)
1
life -= 1;
2
if (life < 1000 && shake < 0)
3
    shake = 1;
4
if (life < 500 && shake < 2)
5
    shake = 2;
6
if (movetype == 0)
7
{
8
    if (moving == 0)
9
    {
10
        newx = (xstart + random(60)) - random(60);
11
        newy = (ystart + random(20)) - random(20);
12
        distspeed = distance_to_point(newy, newx) / 20;
13
        move_towards_point(newx, newy, distspeed);
14
        alarm[3] = 8;
15
        moving = 1;
16
        image_speed = 0.5;
17
    }
18
    if (moving == 2)
19
    {
20
        image_speed = 0;
21
        image_index = 0;
22
        chch = choose(0, 1);
23
        thisx = obj_heart.x + 10;
24
        thisy = obj_heart.y + 10;
25
        ltimer = 100;
26
        speed = 0;
27
        moving = 3;
28
        alarm[3] = 30;
29
    }
30
    if (moving == 4)
31
        moving = 0;
32
    if (shake > 0)
33
    {
34
        x += (random(shake) - random(shake));
35
        y += (random(shake) - random(shake));
36
        shake -= 1;
37
    }
38
}
39
lightning_timer += 1;
40
if (ltimer >= 100)
41
{
42
    ltimer += 1;
43
    if (ltimer == 100 || ltimer == 102 || ltimer == 104 || ltimer == 106)
44
    {
45
        lt = instance_create(x, y, obj_mettlightning_pl);
46
        lt.friction = -0.1;
47
        lt.speed = 8;
48
        lt.direction = point_direction(x, y, thisx, thisy);
49
    }
50
    if (ltimer == 108 || ltimer == 110 || ltimer == 112 || ltimer == 114)
51
    {
52
        lt = instance_create(x, y, obj_mettlightning_pl);
53
        lt.friction = -0.1;
54
        lt.speed = 8;
55
        if (chch == 1)
56
            lt.direction = point_direction(x, y, thisx, thisy) - 10;
57
        else
58
            lt.direction = point_direction(x, y, thisx, thisy) + 10;
59
    }
60
    if (ltimer == 116 || ltimer == 118 || ltimer == 120 || ltimer == 122)
61
    {
62
        lt = instance_create(x, y, obj_mettlightning_pl);
63
        lt.friction = -0.1;
64
        lt.speed = 8;
65
        if (chch == 1)
66
            lt.direction = point_direction(x, y, thisx, thisy) + 10;
67
        else
68
            lt.direction = point_direction(x, y, thisx, thisy) - 10;
69
    }
70
    if (ltimer == 125)
71
        ltimer = 0;
72
}
73
if (size > 1)
74
{
75
    image_xscale = size;
76
    image_yscale = size;
77
    size -= 0.5;
78
    if (size == 1)
79
        image_index = 0;
80
}
81
if (lastcon == 1 && global.turntimer > 1)
82
{
83
    with (obj_ratingsmaster)
84
        active = 0;
85
    movetype = 1;
86
    lightning_timer = 400;
87
    visible = false;
88
    global.faceemotion = 6;
89
    obj_mettb_body.pause = 2;
90
    obj_mettb_body.hurt = 2;
91
    obj_mettb_body.dsf = 2;
92
    obj_mettattackgen.dark = 0;
93
    caster_stop(all);
94
    obj_heart.shot = 0;
95
    global.turntimer = 900;
96
    mtb = instance_create(x, y, obj_mettheart_burst);
97
    mtb.homex = xstart;
98
    mtb.homey = ystart;
99
    mtb.another = 1;
100
    lastcon = 2;
101
}
102
if (lastcon >= 2)
103
{
104
    global.faceemotion = 6;
105
    obj_mettb_body.hurt = 2;
106
}
107
if (lastcon == 3)
108
{
109
    with (obj_mettattackgen)
110
        instance_destroy();
111
    lastcon = 4;
112
    alarm[4] = 50;
113
}
114
if (lastcon == 4)
115
    obj_mettb_body.dsf -= 0.04;
116
if (lastcon == 5)
117
{
118
    obj_mettatonex.con = 50;
119
    global.mnfight = -1;
120
    global.myfight = -1;
121
    instance_destroy();
122
}