diff options
author | Henrique Alves <henriquelalves@gmail.com> | 2022-07-16 13:21:40 -0300 |
---|---|---|
committer | Henrique Alves <henriquelalves@gmail.com> | 2022-07-16 13:21:40 -0300 |
commit | 474d7a8112f81712e0b612c22ec3ac9608a858d1 (patch) | |
tree | b623ab6fd41c2657fc8501659d5be0fa3d88925a | |
parent | 4e06d14ebd6a3e452fa190478c6b825bd81afd95 (diff) | |
download | gamejam-gmtk-2022-474d7a8112f81712e0b612c22ec3ac9608a858d1.tar.gz gamejam-gmtk-2022-474d7a8112f81712e0b612c22ec3ac9608a858d1.tar.bz2 gamejam-gmtk-2022-474d7a8112f81712e0b612c22ec3ac9608a858d1.zip |
Add difficulty depending on stage progression
-rw-r--r-- | Scenes/Dungeon.gd | 10 | ||||
-rw-r--r-- | Scenes/Global.gd | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/Scenes/Dungeon.gd b/Scenes/Dungeon.gd index 7264e12..38800ba 100644 --- a/Scenes/Dungeon.gd +++ b/Scenes/Dungeon.gd @@ -58,7 +58,8 @@ func build_floor(): set_tile(monster, rand_pos) add_child(monster) - for i in range(2): + var number_doors = floor(Global.current_stage / 10.0) + 1 + for i in range(number_doors): rand_pos = Vector2(randi()%8 - 4, randi()%8 - 4) while tiles_entities.has(rand_pos): rand_pos = Vector2(randi()%8 - 4, randi()%8 - 4) @@ -99,14 +100,17 @@ func _process(delta): next_stage = false break if next_stage: - Global.turns += Global.BONUS_TURNS_STAGE_FINISH - get_tree().change_scene("res://Scenes/Dungeon.tscn") + next_stage() if not idle or input == Vector2.ZERO: return process_turn_logic() +func next_stage(): + Global.turns += Global.BONUS_TURNS_STAGE_FINISH + Global.current_stage += 1 + get_tree().change_scene("res://Scenes/Dungeon.tscn") func process_turn_logic(): # player attack diff --git a/Scenes/Global.gd b/Scenes/Global.gd index 4bef11b..1a4c020 100644 --- a/Scenes/Global.gd +++ b/Scenes/Global.gd @@ -4,9 +4,14 @@ onready var STARTING_TURNS = 20 onready var BONUS_TURNS_STAGE_FINISH = 10 onready var turns = STARTING_TURNS setget set_turns +onready var current_stage = 0 setget set_stage signal update_ui func set_turns(t): turns = t emit_signal("update_ui") + +func set_stage(s): + current_stage = s + emit_signal("update_ui") |