Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuSai committed Jan 26, 2022
1 parent 43fd43e commit 626b0ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Autoloads/SavedData.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ var hp: int = 4
var weapons: Array = []
var equipped_weapon_index: int = 0

func reset_data() -> void:
num_floor = 0

hp = 4
weapons = []
equipped_weapon_index = 0

1 change: 1 addition & 0 deletions Characters/Character.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func take_damage(dam: int, dir: Vector2, force: int) -> void:
SavedData.hp = hp
if hp == 0:
SceneTransistor.start_transition_to("res://Game.tscn")
SavedData.reset_data()
if hp > 0:
state_machine.set_state(state_machine.states.hurt)
velocity += dir * force
Expand Down

0 comments on commit 626b0ae

Please sign in to comment.