Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_healthbar_Draw_0

(view raw script w/o annotations or w/e)
1
if (init == 0 && i_ex(target))
2
{
3
    if (target.name == "kris")
4
        mycolor = hexcolor(#DBFC8F);
5
    if (target.name == "susie")
6
        mycolor = hexcolor(#EC95FB);
7
    if (target.name == "ralsei")
8
        mycolor = hexcolor(#1DE6B5);
9
    init = 1;
10
}
11
if (target == 0)
12
{
13
    if (index == 0)
14
    {
15
        with (obj_mainchara_board)
16
        {
17
            if (name == "kris")
18
                other.target = id;
19
        }
20
    }
21
    if (index == 1)
22
    {
23
        with (obj_mainchara_board)
24
        {
25
            if (name == "susie")
26
                other.target = id;
27
        }
28
    }
29
    if (index == 2)
30
    {
31
        with (obj_mainchara_board)
32
        {
33
            if (name == "ralsei")
34
                other.target = id;
35
        }
36
    }
37
}
38
var dead = 0;
39
if (target.myhealth <= 0)
40
    dead = true;
41
var healthamt = target.myhealth / target.maxhealth;
42
if (healthamt > 1)
43
    healthamt = 1;
44
draw_sprite_ext(sprite_index, dead, x, y, 2, 2, image_angle, image_blend, image_alpha);
45
draw_sprite_ext(spr_whitepx, 0, x + 14, y + 12, round(healthamt * 50), 6, image_angle, mycolor, image_alpha);