Undertale script viewer

← back to main script listing

gml_Object_obj_targetchoiceHITSEVERYONE_Step_0

(view raw script w/o annotations or w/e)
1
if (hspeed > 0)
2
{
3
    if (x > (obj_target.x + obj_target.sprite_width))
4
        xxx = 1;
5
}
6
if (hspeed < 0)
7
{
8
    if (x < obj_target.x)
9
        xxx = 1;
10
}
11
if (xxx == 1)
12
{
13
    global.damage = 0;
14
    global.hurtanim[global.mytarget] = 5;
15
    instance_destroy();
16
    exit;
17
}
18
if (image_speed == 0)
19
{
20
    if (control_check_pressed(0))
21
    {
22
        for (i = 0; i < 3; i += 1)
23
        {
24
            if (global.monster[i] == 1)
25
            {
26
                mons = global.monsterinstance[i];
27
                hspeed = 0;
28
                script_execute(scr_attackcalc);
29
                global.damage = damage;
30
                global.damage += random(2);
31
                myx = x + (sprite_width / 2);
32
                myperfectx = obj_target.x + (obj_target.sprite_width / 2);
33
                bonusfactor = abs(myx - myperfectx);
34
                if (bonusfactor == 0)
35
                    bonusfactor = 1;
36
                global.stretch = (obj_target.sprite_width - bonusfactor) / obj_target.sprite_width;
37
                if (bonusfactor <= 12)
38
                    global.damage = round(global.damage * 2.2);
39
                if (bonusfactor > 12)
40
                    global.damage = round(global.damage * global.stretch * 2);
41
                mons.takedamage = global.damage;
42
                instance_create((mons.x + (mons.sprite_width / 2)) - 5, mons.y - 5, obj_slice);
43
                global.hurtanim[i] = 1;
44
                image_speed = 0.4;
45
            }
46
        }
47
    }
48
}
49
if (global.myfight != 1)
50
    instance_destroy();