Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Comet |
(Sorry for my english i’m using google translator)
I made a strip of hp, and a command to restore it, but I noticed that when I restore hp, the value is greater than 100
Hard to answer without seeing the code. Can you show / describe what’s in your restore function?
Thomas Karcher | 2019-07-01 15:25
Maybe you accidentally enable Allow Greater
?
Dlean Jeans | 2019-07-01 15:37
Allow greater switched off
Comet | 2019-07-01 15:49
onready var hp = 100
func _ready():
console.connect('text_entered', self, 'console')
func _input(event):
if event.is_action_pressed('ui_focus_next'):
hp -= 10
func _physics_process(delta):
get_node("Control/Healbar").set_value(hp)
if hp >= 1:
hp += delta * 0.6
func console(text):
elif text == 'hp' || text == 'health': #When I enter it, I get more hp than needed
print('hp')
$Console/TextConsole.add_text('\ncheat true')
$Console.clear()
hp += 100
Comet | 2019-07-01 15:54