Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_carrotthrower_Step_0

(view raw script w/o annotations or w/e)
1
buffer += 1;
2
if (buffer == 19)
3
{
4
    gravity = 0;
5
    vspeed = 0;
6
    hspeed = 4 * dir;
7
    depth = -10;
8
}
9
if (buffer >= 19)
10
{
11
    y = obj_battlesolid.y - (obj_battlesolid.sprite_height / 2);
12
    if (x <= ((obj_battlesolid.x - (obj_battlesolid.sprite_width / 2)) + 20))
13
    {
14
        x += 4;
15
        if (hspeed < 0)
16
            hspeed = -hspeed;
17
    }
18
    if (x <= ((obj_battlesolid.x - (obj_battlesolid.sprite_width / 2)) + 20))
19
    {
20
        x += 4;
21
        if (hspeed < 0)
22
            hspeed = -hspeed;
23
    }
24
    if (x >= ((obj_battlesolid.x + (obj_battlesolid.sprite_width / 2)) - 20))
25
    {
26
        x -= 4;
27
        if (hspeed > 0)
28
            hspeed = -hspeed;
29
    }
30
    if (buffer >= 20 && con == 0 && abs(x - (obj_heart.x + 10)) < 30)
31
        con = 5;
32
    if (con == 5)
33
    {
34
        image_speed = 0.5;
35
        con = 6;
36
    }
37
    if (con == 6)
38
    {
39
        if (image_index >= 2 && throw_n == 0)
40
        {
41
            throw_n = 1;
42
            carrot = instance_create(x, y, obj_collidebullet);
43
            
scr_bullet_inherit
scr_bullet_inherit

function
scr_bullet_inherit(arg0)
{ if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; if (object_index == obj_dbulletcontroller) { arg0.creatorid = creatorid; arg0.creator = creator; } arg0.element = element; } }
(carrot);
44
            with (carrot)
45
            {
46
                speedmax = 7;
47
                if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 2)
48
                    speedmax = 6;
49
                if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 3)
50
                    speedmax = 5;
51
                active = 1;
52
                image_xscale = 2;
53
                image_yscale = 2;
54
                vspeed = speedmax;
55
                image_speed = 0.25;
56
                sprite_index = spr_carrotbullet;
57
            }
58
        }
59
        if (image_index >= 3)
60
        {
61
            throw_n = 0;
62
            image_speed = 0;
63
            con = 7;
64
            alarm[4]
 = 15;
gml_Object_obj_carrotthrower_Alarm_4.gml

con += 1;
65
            if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 2)
66
                alarm[4]
 = 22;
gml_Object_obj_carrotthrower_Alarm_4.gml

con += 1;
67
            if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 3)
68
                alarm[4]
 = 30;
gml_Object_obj_carrotthrower_Alarm_4.gml

con += 1;
69
        }
70
    }
71
    if (con == 8)
72
    {
73
        image_index = 0;
74
        con = 0;
75
    }
76
}