HealthBar2D

An asset by vishu
The page banner background of a mountain and forest
HealthBar2D hero image

Quick Information

0 ratings
HealthBar2D icon image
vishu
HealthBar2D

This project is a Godot Engine addon that adds a HealthBar2D node to the editor. It extends the TextureProgress node and can be used to make various Progress bars that can represent Health, Stamina, Hunger, etc.Read README.md for instructions and take a look at example.tscn.

Supported Engine Version
4.0
Version String
0.2.0
License Version
MIT
Support Level
community
Modified Date
11 months ago
Git URL
Issue URL

HealthBar2D

addon-icon

Note: this addon is under development/testing right now

A 2d Health bar implementation for the Godot Engine, written in GDScript.

This project is a Godot Engine addon that adds a HealthBar2D node to the editor. It extends the TextureProgress node and can be used to make various Progress bars that can represent Health, Stamina, Hunger, etc. It is released under the terms of the MIT License.

Installation

  • Clone this repository and move the content of the addons directory into the res://addons of your project
  • In your project settings, enable the plugin

Usage

After enabling, it will add a HealthBar2D node.

  • Add this node as a child of the character you like
  • As it extends from TextureProgress it will require texture. You can use the given health_bar_texture.png in the resources directory of the addon.
  • resize the Rect control property by clicking the circular arrow in the Inspector
  • Now you need two things in the parent character script. the health variable and the health_changed signal
extends KinematicBody2D  # example

signal health_changed

var health := 10
  • Before running the project. you also need to call the initialize method from the parent

One can add multiple bars using HealthBar2D and handle value change logic inside character script, just remember to emit the related signal.

func _ready() -> void:
    $HealthBar2D.initialize("health_changed", health)
  • Now whenever the character takes damage, emit our health_changed signal with the current health.
emit_signal("health_changed", health)

Thats it!

You can take a look at example.tscn scene in the example directory for a working example.

This project is a Godot Engine addon that adds a HealthBar2D node to the editor. It extends the TextureProgress node and can be used to make various Progress bars that can represent Health, Stamina, Hunger, etc.

Read README.md for instructions and take a look at example.tscn.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
HealthBar2D icon image
vishu
HealthBar2D

This project is a Godot Engine addon that adds a HealthBar2D node to the editor. It extends the TextureProgress node and can be used to make various Progress bars that can represent Health, Stamina, Hunger, etc.Read README.md for instructions and take a look at example.tscn.

Supported Engine Version
4.0
Version String
0.2.0
License Version
MIT
Support Level
community
Modified Date
11 months ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers