Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_dw_teevie_employee_Create_0

(view raw script w/o annotations or w/e)
1
employee_type = "";
2
unhappy_sprite = -4;
3
shock_sprite = -4;
4
joy_sprite = -4;
5
6
init = function(arg0)
7
{
8
    employee_type = arg0;
9
    switch (employee_type)
10
    {
11
        case "shadowman":
12
            unhappy_sprite = 1477;
13
            shock_sprite = 2628;
14
            joy_sprite = 4868;
15
            break;
16
        case "pippins":
17
            unhappy_sprite = 2283;
18
            shock_sprite = 1538;
19
            joy_sprite = 1931;
20
            break;
21
        default:
22
            unhappy_sprite = 2822;
23
            shock_sprite = 4115;
24
            joy_sprite = 1514;
25
            break;
26
    }
27
    image_xscale = 2;
28
    image_yscale = 2;
29
    
scr_depth
scr_depth

function
scr_depth()
{ if (argument_count > 0) { with (argument0) depth = 100000 - ((y * 10) + (sprite_height * 10)); } else { depth = 100000 - ((y * 10) + (sprite_height * 10)); } }
();
30
};
31
32
stop_anim = function()
33
{
34
    image_speed = 0;
35
    image_index = 0;
36
};
37
38
shock = function()
39
{
40
    stop_anim();
41
    sprite_index = shock_sprite;
42
    if (employee_type == "pippins")
43
        image_index = irandom(5);
44
    
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
();
45
};
46
47
joy = function()
48
{
49
    sprite_index = joy_sprite;
50
    image_speed = 0.2;
51
    if (employee_type == "zapper")
52
        image_speed = 0.8;
53
    
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
();
54
};
55
56
unhappy = function()
57
{
58
    stop_anim();
59
    sprite_index = unhappy_sprite;
60
};
61
62
set_custom_sprite = function(arg0)
63
{
64
    stop_anim();
65
    sprite_index = arg0;
66
};