0 votes

(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

in Engine by (60 points)

Hard to answer without seeing the code. Can you show / describe what's in your restore function?

Maybe you accidentally enable Allow Greater?

Allow greater switched off

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

1 Answer

+1 vote
Best answer

Just change

hp += 100

to

hp = 100
by (4,165 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.