kaplay-health-bars
v1.2.1
Published
 <br>_๐ง This package is a work in progress! ๐ง_ _Expect breaking changes and incomplete features._
Downloads
6
Readme
KAPLAY Health Bars
Easily add customizable health bars to your KAPLAY games!
๐ฆ Installation
Install via npm:
npm i kaplay-health-bars๐ Usage
Import the health bar into your kaplay project:
import kaplay from "kaplay";
import "kaplay/global";
import { makeHealthBar } from "kaplay-health-bars";
kaplay();
const hb = makeHealthBar(300, 30, 100, 100, 100);
add(hb);
// Use kaplays "hurt()" method to decrease health
hb.hurt();
// Use kaplays "heal()" method to increase health
hb.heal();Parameters
The health bar can take the following parameters:
| Parameter | Type | Default | Required | Description |
| ------------- | -------- | ------- | -------- | -------------------- |
| w | number | N/A | โ
Yes | Width of health bar |
| h | number | N/A | โ
Yes | Height of health bar |
| x | number | N/A | โ
Yes | x position |
| y | number | N/A | โ
Yes | y position |
| hp | number | N/A | โ
Yes | Number of health |
| healthColor | rgb | GREEN | โ No | Health bar colour |
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
Have questions or suggestions? Reach out via:
- GitHub Issues
