Update Enemy.gd

This commit is contained in:
Victor Turgeon 2023-10-11 11:09:24 -04:00
parent 3a64322470
commit 36844903ad

View File

@ -8,7 +8,7 @@ extends CharacterBody2D
@onready var is_dying: bool = false @onready var is_dying: bool = false
@export var level: int = 1 @export var level: int = 1
@export var hp: int = 50 @export var hp: int = 100
@export var maxhp: int = 100 @export var maxhp: int = 100
@export var maxvel: float = 2 @export var maxvel: float = 2
@export var experience: int = 0 @export var experience: int = 0
@ -178,7 +178,7 @@ func receive_damage(dmg):
func receive_exp(x): func receive_exp(x):
experience += x experience += x
if experience > levelup[level - 1] && level <= 8: while experience > levelup[level - 1] && level <= 8:
setLevel(level + 1) setLevel(level + 1)
exp_gained.emit(experience, 0 if level == 1 else levelup[level - 2] ,levelup[level - 1], level) exp_gained.emit(experience, 0 if level == 1 else levelup[level - 2] ,levelup[level - 1], level)