Created
June 6, 2024 06:39
-
-
Save Jeremi360/85f9bde6423b6d92e675e5978f9841b3 to your computer and use it in GitHub Desktop.
to help some one on the intenet with InvetorySystem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In Player script | |
var stats := { | |
healt = 0, | |
mana = 0, | |
} | |
var healt := 0: # change to 0.0 if you want float | |
set(value): | |
stats.healt = value | |
get: return stats.healt | |
var mana := 0: # change to 0.0 if you want float | |
set(value): | |
stats.mana = value | |
get: return stats.mana | |
# In ItemDataConsumable | |
var stats := { | |
healt = 0, | |
mana = 0, | |
} | |
@export | |
var healt := 0: # change to 0.0 if you want float | |
set(value): | |
healt = value # to make sure it's saved in Resource | |
stats.healt = value | |
get: return healt | |
@export | |
var mana := 0: # change to 0.0 if you want float | |
set(value): | |
mana = value # to make sure it's saved in Resource | |
stats.mana = value | |
get: return mana | |
func use(target): | |
target.stats += stats |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment