Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_traffic_switch_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (count == 0)
4
    {
5
        obj_traffic_switch.groupcheck = swapgroup;
6
        obj_traffic_switch.bossidcheck = id;
7
        boss = 1;
8
        with (obj_traffic_switch)
9
        {
10
            if (swapgroup == groupcheck)
11
            {
12
                bossid = bossidcheck;
13
                bossid.allcount++;
14
                bossid.countid[count] = id;
15
                bossid.counttimer[count] = default_time;
16
                bossid.counttype[count] = type;
17
            }
18
        }
19
        obj_traffic_switch.allcountcheck = allcount;
20
        with (obj_traffic_switch)
21
        {
22
            if (swapgroup == groupcheck)
23
                allcount = allcountcheck;
24
        }
25
    }
26
    init = 1;
27
}
28
if (myinteract == 1)
29
{
30
    myinteract = 0;
31
    with (obj_mainchara)
32
        onebuffer = 5;
33
}
34
if (active == 1 && (global.interact == 0 || i_ex(obj_cutscene_master)))
35
{
36
    timer--;
37
    if (timer <= 0)
38
    {
39
        timer = default_time * timefactor;
40
        active = 0;
41
        snd_play(snd_noise);
42
        if (instance_exists(obj_traffic_car))
43
            obj_traffic_car.groupcheck = group;
44
        if (instance_exists(obj_traffic_car_generator))
45
            obj_traffic_car_generator.groupcheck = group;
46
        with (obj_traffic_car)
47
        {
48
            if (group == groupcheck)
49
            {
50
                walking = 0;
51
                active = 1;
52
            }
53
        }
54
        with (obj_traffic_car_generator)
55
        {
56
            if (group == groupcheck)
57
            {
58
                walking = 0;
59
                active = 1;
60
            }
61
        }
62
        if (instance_exists(obj_cybercity_bg_trafficlight_shine))
63
        {
64
            var group_check = group;
65
            with (obj_cybercity_bg_trafficlight_shine)
66
            {
67
                if (group == group_check)
68
                    stop = 0;
69
            }
70
        }
71
    }
72
}
73
if (clear_traffic)
74
{
75
    if (i_ex(obj_traffic_car))
76
    {
77
        with (obj_traffic_car)
78
        {
79
            y += myspeed;
80
            if (y >= (cameray() + view_hport[0] + 100))
81
                instance_destroy();
82
        }
83
    }
84
    else
85
    {
86
        clear_traffic = false;
87
    }
88
}
89
pressbuffer--;