Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_testoverworldenemy_Step_0

(view raw script w/o annotations or w/e)
1
if (con == 0)
2
{
3
    if (global.interact == 0)
4
        frozen = 0;
5
    if (
scr_outside_camera
scr_outside_camera

function
scr_outside_camera(arg0)
{ _offcamera = 0; rightx = x + sprite_width; leftx = x; bottomy = y + sprite_height; topy = y; if (x > (__view_get(e__VW.XView, 0) + __view_get(e__VW.WView, 0) + arg0)) _offcamera = 1; if (rightx < (__view_get(e__VW.XView, 0) - arg0)) _offcamera = 1; if (y > (__view_get(e__VW.YView, 0) + __view_get(e__VW.HView, 0) + arg0)) _offcamera = 1; if (bottomy < (__view_get(e__VW.YView, 0) - arg0)) _offcamera = 1; return _offcamera; } enum e__VW { XView, YView, WView, HView, Angle, HBorder, VBorder, HSpeed, VSpeed, Object, Visible, XPort, YPort, WPort, HPort, Camera, SurfaceID }
(200))
6
        frozen = 1;
7
    else
8
        frozen = 0;
9
    if (global.interact != 0)
10
        frozen = 1;
11
    if (frozen == 1)
12
    {
13
        if (hadfrozen == 0)
14
        {
15
            remspeed = speed;
16
            speed = 0;
17
            hadfrozen = 1;
18
        }
19
    }
20
    if (frozen == 0)
21
    {
22
        if (hadfrozen == 1)
23
        {
24
            if (speed == 0)
25
                speed = remspeed;
26
            hadfrozen = 0;
27
        }
28
    }
29
    if (frozen == 0)
30
    {
31
        fliptimer += 1;
32
        if (fliptimer >= 30)
33
        {
34
            vspeed = -vspeed;
35
            fliptimer = 0;
36
        }
37
    }
38
}
39
if (con == 1)
40
{
41
    sprite_index = touchsprite;
42
    if (washit == 0 && global.ambush == 0)
43
    {
44
        hnka = snd_play(snd_tensionhorn);
45
        con = 2;
46
        alarm[4]
 = 8;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
47
    }
48
    if (washit == 1 || global.ambush == 2)
49
    {
50
        hnka = snd_play(snd_break2);
51
        con = 4;
52
        alarm[4]
 = 10;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
53
    }
54
    if (washit == 0 && global.ambush == 1)
55
    {
56
        snd_play(snd_battleenter);
57
        con = 4;
58
        alarm[4]
 = 10;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
59
    }
60
}
61
if (con == 3)
62
{
63
    hnkb = snd_play(snd_tensionhorn);
64
    snd_pitch(hnkb, 1.1);
65
    con = 4;
66
    alarm[4]
 = 12;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
67
}
68
if (con == 5)
69
{
70
    depth = 5000;
71
    instance_create(0, 0, obj_battleback);
72
    instance_create(0, 0, obj_encounterbasic);
73
    con = 5.5;
74
    sprite_index = slidesprite;
75
    direction = point_direction(x, y, global.monstermakex[whichmonster], global.monstermakey[whichmonster]);
76
    speed = point_distance(x, y, global.monstermakex[whichmonster], global.monstermakey[whichmonster]) / 10;
77
    copyhave = 0;
78
    copy[0] = -1;
79
    copy[1] = -1;
80
    copy[2] = -1;
81
    for (cc = 0; cc < 3; cc += 1)
82
    {
83
        if (global.monstertype[cc] != 0(None) && cc != whichmonster)
84
        {
85
            copyhave += 1;
86
            if (global.monstertype[cc] == global.monstertype[whichmonster])
87
            {
88
                copy[cc] = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(x, y, sprite_index);
89
                copy[cc].direction = point_direction(x, y, global.monstermakex[cc], global.monstermakey[cc]);
90
                copy[cc].speed = point_distance(x, y, global.monstermakex[cc], global.monstermakey[cc]) / 10;
91
                copy[cc].depth = depth - 1 - cc;
92
            }
93
            else
94
            {
95
                copy[cc] = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(global.monstermakex[cc] + 200, global.monstermakey[cc], object_get_sprite(global.monsterinstancetype[cc]));
96
                copy[cc].cc = cc;
97
                copy[cc].depth = depth - 1 - cc;
98
                with (copy[cc])
99
                {
100
                    direction = point_direction(x, y, global.monstermakex[cc], global.monstermakey[cc]);
101
                    speed = point_distance(x, y, global.monstermakex[cc], global.monstermakey[cc]) / 10;
102
                }
103
            }
104
        }
105
    }
106
    afterimagetimer = 0;
107
    alarm[4]
 = 10;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
108
}
109
if (con == 6)
110
{
111
}
112
if (con == 6.5)
113
{
114
    for (c = 0; c < 3; c += 1)
115
    {
116
        with (copy[c])
117
            speed = 0;
118
    }
119
    speed = 0;
120
    con = 6;
121
    alarm[4]
 = 14;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
122
}
123
if (con == 7)
124
{
125
    if (eraser == 1)
126
    {
127
        with (obj_chaseenemy)
128
            instance_destroy();
129
    }
130
    if (eraser == 2)
131
    {
132
        with (obj_chaseenemy)
133
        {
134
            if (eraser == 2)
135
                instance_destroy();
136
        }
137
    }
138
    instance_destroy();
139
    for (c = 0; c < 3; c += 1)
140
    {
141
        with (copy[c])
142
            instance_destroy();
143
    }
144
}