Last active
September 9, 2024 06:44
-
-
Save levidavidmurray/90f9a06dd3f38dbd5ad3f2758a755474 to your computer and use it in GitHub Desktop.
GDScript Level Up Menu Example
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
class_name Player | |
extends Node2D | |
enum StatType { HEALTH, DAMAGE, LUCK } | |
var _stats: Dictionary = { | |
StatType.HEALTH: 10, | |
StatType.DAMAGE: 1, | |
StatType.LUCK: 1, | |
} | |
var health: | |
get: return _stats[StatType.HEALTH] | |
var damage: | |
get: return _stats[StatType.DAMAGE] | |
var luck: int: | |
get: return _stats[StatType.LUCK] | |
func set_stats(stats_dict: Dictionary): | |
_stats = stats_dict | |
func set_stat(stat_type: StatType, points: int): | |
_stats[stat_type] = points |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment