Deltarune (Chapter 1) 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
    hnka = snd_play(snd_tensionhorn);
43
    con = 2;
44
    alarm[4]
 = 8;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
45
}
46
if (con == 3)
47
{
48
    hnkb = snd_play(snd_tensionhorn);
49
    snd_pitch(hnkb, 1.1);
50
    con = 4;
51
    alarm[4]
 = 12;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
52
}
53
if (con == 5)
54
{
55
    depth = 5000;
56
    instance_create(0, 0, obj_battleback);
57
    instance_create(0, 0, obj_encounterbasic);
58
    con = 6;
59
    sprite_index = slidesprite;
60
    direction = point_direction(x, y, global.monstermakex[0], global.monstermakey[0]);
61
    speed = point_distance(x, y, global.monstermakex[0], global.monstermakey[0]) / 10;
62
    copyhave = 0;
63
    for (cc = 0; cc < 2; cc += 1)
64
    {
65
        if (global.monstertype[cc + 1] != 0(None))
66
        {
67
            copyhave += 1;
68
            if (global.monstertype[cc + 1] == global.monstertype[0])
69
            {
70
                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);
71
                copy[cc].direction = point_direction(x, y, global.monstermakex[cc + 1], global.monstermakey[cc + 1]);
72
                copy[cc].speed = point_distance(x, y, global.monstermakex[cc + 1], global.monstermakey[cc + 1]) / 10;
73
                copy[cc].depth = depth - 1 - cc;
74
            }
75
            else
76
            {
77
                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 + 1] + 200, global.monstermakey[cc + 1], object_get_sprite(global.monsterinstancetype[cc + 1]));
78
                copy[cc].cc = cc;
79
                copy[cc].depth = depth - 1 - cc;
80
                with (copy[cc])
81
                {
82
                    direction = point_direction(x, y, global.monstermakex[cc + 1], global.monstermakey[cc + 1]);
83
                    speed = point_distance(x, y, global.monstermakex[cc + 1], global.monstermakey[cc + 1]) / 10;
84
                }
85
            }
86
        }
87
    }
88
    alarm[4]
 = 10;
gml_Object_obj_testoverworldenemy_Alarm_4.gml

con += 1;
89
}
90
if (con == 7)
91
{
92
    if (copyhave > 0)
93
    {
94
        for (c = 0; c < copyhave; c += 1)
95
        {
96
            with (copy[c])
97
                speed = 0;
98
        }
99
    }
100
    speed = 0;
101
    if (instance_exists(obj_battlecontroller))
102
    {
103
        if (eraser == 1)
104
        {
105
            with (obj_chaseenemy)
106
                instance_destroy();
107
        }
108
        instance_destroy();
109
        if (copyhave > 0)
110
        {
111
            for (c = 0; c < copyhave; c += 1)
112
            {
113
                with (copy[c])
114
                    instance_destroy();
115
            }
116
        }
117
    }
118
}