Deltarune script viewer

← back to main script listing

gml_Object_obj_carrotthrower_ch1_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_ch1.y - obj_battlesolid_ch1.sprite_height / 2
12
    if (x <= (obj_battlesolid_ch1.x - obj_battlesolid_ch1.sprite_width / 2 + 20))
13
    {
14
        x += 4
15
        if (hspeed < 0)
16
            hspeed = (-hspeed)
17
    }
18
    if (x <= (obj_battlesolid_ch1.x - obj_battlesolid_ch1.sprite_width / 2 + 20))
19
    {
20
        x += 4
21
        if (hspeed < 0)
22
            hspeed = (-hspeed)
23
    }
24
    if (x >= (obj_battlesolid_ch1.x + obj_battlesolid_ch1.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_ch1.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_ch1(x, y, obj_collidebullet_ch1)
43
            scr_bullet_inherit_ch1
scr_bullet_inherit_ch1

function scr_bullet_inherit_ch1(argument0) //gml_Script_scr_bullet_inherit_ch1 { if instance_exists(argument0) { argument0.damage = damage argument0.grazepoints = grazepoints argument0.timepoints = timepoints argument0.inv = inv argument0.target = target argument0.grazed = 0 argument0.grazetimer = 0 } }
(carrot)
44
            with (carrot)
45
            {
46
                speedmax = 7
47
                if (scr_monsterpop_ch1
scr_monsterpop_ch1

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

function scr_monsterpop_ch1() //gml_Script_scr_monsterpop_ch1 { 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_ch1
57
            }
58
        }
59
        if (image_index >= 3)
60
        {
61
            throw_n = 0
62
            image_speed = 0
63
            con = 7
64
            alarm[4] = 15
65
            if (scr_monsterpop_ch1
scr_monsterpop_ch1

function scr_monsterpop_ch1() //gml_Script_scr_monsterpop_ch1 { return (global.monster[0] + global.monster[1] + global.monster[2]); }
() == 2)
66
                alarm[4] = 22
67
            if (scr_monsterpop_ch1
scr_monsterpop_ch1

function scr_monsterpop_ch1() //gml_Script_scr_monsterpop_ch1 { return (global.monster[0] + global.monster[1] + global.monster[2]); }
() == 3)
68
                alarm[4] = 30
69
        }
70
    }
71
    if (con == 8)
72
    {
73
        image_index = 0
74
        con = 0
75
    }
76
}