Skip to content

Commit 54b3d2d

Browse files
committed
a clickable slot containing and displaying an Ability
1 parent 9d34992 commit 54b3d2d

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

UI/AbilitySlot.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
class AbilitySlot extends UIElement
2+
{
3+
ability = null;
4+
constructor(rekt,ability)
5+
{
6+
super(rekt);
7+
this.ability=ability;
8+
}
9+
draw(ctx)
10+
{
11+
super.draw(ctx);
12+
UIRenderer.drawFrame(ctx,this.hitbox.x, this.hitbox.y,this.hitbox.width,this.hitbox.height);
13+
if(this.ability!=null)
14+
{
15+
UIRenderer.drawGauge(ctx,
16+
this.hitbox.x+6,this.hitbox.y+6,24,this.hitbox.height-8,
17+
Math.floor(this.ability.charge),this.ability.maxcharge,
18+
"0 255 50");
19+
}
20+
}
21+
click()
22+
{
23+
this.ability.use();
24+
}
25+
}

0 commit comments

Comments
 (0)