Deltarune script viewer

← back to main script listing

gml_Object_obj_starwalker_overworld_ch1_Draw_0

(view raw script w/o annotations or w/e)
1
targetx = obj_mainchara_ch1.x + (obj_mainchara_ch1.sprite_width / 2);
2
bodyfacing = 1;
3
if (targetx <= (x - 30))
4
    bodyfacing = 0;
5
if (targetx >= (x + 30))
6
    bodyfacing = 2;
7
if (attackcon < 2)
8
{
9
    if (bodyfacing == 0)
10
        xmake = -2;
11
    if (bodyfacing == 2)
12
        xmake = 2;
13
}
14
bounce = sin(siner / 5);
15
wing_index += (0.2 + abs(bounce / 8));
16
if (attackcon == -1)
17
    draw_sprite_ext(spr_starwalker_attack_ch1, 0, x, y + (bounce * 4), xmake, 2, image_angle, c_white, image_alpha);
18
if (attackcon == 0)
19
{
20
    siner += 1;
21
    draw_sprite_ext(spr_starwalker_wings_ch1, wing_index, x, y + (bounce * 4), 2, 2, image_angle, c_white, image_alpha);
22
    draw_sprite_ext(spr_starwalker_body_ch1, bodyfacing, x, y + (sin(siner / 5) * 2), 2, 2, image_angle, c_white, image_alpha);
23
}
24
if (attackcon == 1)
25
    draw_sprite_ext(spr_starwalker_attack_ch1, 0, x, y + (bounce * 4), xmake, 2, image_angle, c_white, image_alpha);
26
if (attackcon == 2)
27
{
28
    shkx = random(shakefactor);
29
    shky = random(shakefactor);
30
    if (shakefactor > 0)
31
        shakefactor -= 1;
32
    draw_sprite_ext(spr_starwalker_attack_ch1, 1, x + shkx, y + shky + (bounce * 4), xmake, 2, image_angle, c_white, image_alpha);
33
}