Skip to content

Instantly share code, notes, and snippets.

@Razzlegames
Created December 22, 2020 00:38
Show Gist options
  • Save Razzlegames/56bee431f14ac51bee56941538d394bf to your computer and use it in GitHub Desktop.
Save Razzlegames/56bee431f14ac51bee56941538d394bf to your computer and use it in GitHub Desktop.
Example using progress bar
extends TextureProgress
onready var Signals = get_node("/root/Signals")
func _ready():
Signals.connect(Signals.UPDATE_ENERGY_EVENT_NAME, self, "updateValue")
#self.size_flags_vertical |= SIZE_EXPAND
func _draw():
var transform = get_global_transform()
var scale = transform.get_scale()
scale.x = min(scale.x, 0.5)
scale.y = min(scale.y, 0.5)
transform = transform.scaled(scale)
draw_set_transform(transform.get_origin(), transform.get_rotation(), scale)
pass
func updateValue(value):
set_value(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment