Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_shapepuzzlebutton_Create_0

(view raw script w/o annotations or w/e)
1
active = false;
2
moveAmount = 10;
3
holdDelayMax = 3;
4
holdDelay = 0;
5
pieceColours = [c_orange, c_green, c_purple, c_yellow, c_aqua];
6
image_speed = 0;
7
troublePiece = 0;
8
myPiece = instance_create_depth(x + choose(0, -20, 20), y + 170, depth, obj_shapepuzzlepiece);
9
depth = 999990;
10
var _count = instance_number(obj_shapepuzzlepiece);
11
icon_color = pieceColours[_count - 1];
12
bird = (_count == 5) ? 1 : 0;
13
berdly_taunt_timer = 0;
14
mybuffer = 0;
15
with (myPiece)
16
{
17
    depth = 999900;
18
    sprite_index = obj_shapepuzzle.sprite_index;
19
    _count = instance_number(obj_shapepuzzlepiece);
20
    image_index = 1 + _count;
21
    image_blend = other.pieceColours[_count - 1];
22
    image_xscale = 2;
23
    image_yscale = 2;
24
    if (room == room_dw_mansion_darkbulb_2 && image_index == 5)
25
        other.troublePiece = true;
26
    var _loopcount;
27
    if (room == room_dw_mansion_darkbulb_3)
28
        _loopcount = irandom(3);
29
    else if (other.troublePiece)
30
        _loopcount = 1;
31
    else
32
        _loopcount = 1 + irandom(2);
33
    repeat (_loopcount)
34
    {
35
        image_angle -= 90;
36
        x += lengthdir_x(sprite_width, image_angle + 90);
37
        y += lengthdir_y(sprite_width, image_angle + 90);
38
    }
39
}
40
if (obj_shapepuzzle.goalHit)
41
    image_index = 8;