fix quest completion logic
This commit is contained in:
parent
8294ff0655
commit
df0a0cffaa
@ -35,7 +35,6 @@ layout_mode = 2
|
|||||||
text = "1"
|
text = "1"
|
||||||
|
|
||||||
[node name="QuestComplete" type="Label" parent="."]
|
[node name="QuestComplete" type="Label" parent="."]
|
||||||
visible = false
|
|
||||||
modulate = Color(1, 1, 1, 0)
|
modulate = Color(1, 1, 1, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
|
@ -24,11 +24,10 @@ func _process(_delta: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _set_goal_text() -> void:
|
func _set_goal_text() -> void:
|
||||||
|
var goalStr = WorldArea.GoalType.keys()[self.goalType].capitalize()
|
||||||
var factionStr = WorldArea.Faction.keys()[self.faction].capitalize()
|
var factionStr = WorldArea.Faction.keys()[self.faction].capitalize()
|
||||||
match self.goalType:
|
$QuestProgress/GoalTypeVal.text = goalStr + " " + factionStr + "s"
|
||||||
WorldArea.GoalType.KILL:
|
|
||||||
$QuestProgress/GoalTypeVal.text = "Kill " + factionStr + "s"
|
|
||||||
|
|
||||||
|
|
||||||
func _set_goal_val() -> void:
|
func _set_goal_val() -> void:
|
||||||
$QuestProgress/GoalVal.text = str(self.goalTotal)
|
$QuestProgress/GoalVal.text = str(self.goalTotal)
|
||||||
@ -48,14 +47,14 @@ func _quest_progress_hide() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _quest_complete_show() -> void:
|
func _quest_complete_show() -> void:
|
||||||
$QuestComplete.show()
|
|
||||||
$QuestComplete.modulate.a += 0.05
|
$QuestComplete.modulate.a += 0.05
|
||||||
|
|
||||||
|
|
||||||
func _generate_random_quest() -> void:
|
func _generate_random_quest() -> void:
|
||||||
pass
|
|
||||||
# TODO: generate random quest
|
# TODO: generate random quest
|
||||||
# self.goalType = GoalTypes.
|
self.goalType = WorldArea.GoalType.KILL
|
||||||
|
self.faction = WorldArea.Faction.CREATURE
|
||||||
|
self.goalTotal = randi_range(20, 50)
|
||||||
# match self.goalType:
|
# match self.goalType:
|
||||||
# GoalTypes.KILLMANY:
|
# GoalTypes.KILLMANY:
|
||||||
# self.faction = KillTypes.NATURAL
|
# self.faction = KillTypes.NATURAL
|
||||||
|
@ -7,7 +7,8 @@ extends Control
|
|||||||
|
|
||||||
var deltaCount := 0
|
var deltaCount := 0
|
||||||
var enemyMoveSpeed := 5.0
|
var enemyMoveSpeed := 5.0
|
||||||
var questComplete := false
|
# var questComplete := false
|
||||||
|
var canContinue := false
|
||||||
|
|
||||||
var middleX
|
var middleX
|
||||||
var playerPos
|
var playerPos
|
||||||
@ -33,9 +34,6 @@ func _ready() -> void:
|
|||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
deltaCount += 1
|
deltaCount += 1
|
||||||
playerPos = Vector2(middleX, get_viewport_rect().size.y * (0.75))
|
playerPos = Vector2(middleX, get_viewport_rect().size.y * (0.75))
|
||||||
if _get_enemies().is_empty() and questComplete:
|
|
||||||
print("Area Complete!")
|
|
||||||
get_tree().quit()
|
|
||||||
|
|
||||||
|
|
||||||
func _generate_quest() -> void:
|
func _generate_quest() -> void:
|
||||||
@ -47,7 +45,7 @@ func _create_enemy():
|
|||||||
var enemy = load("res://scenes/enemy.tscn").instantiate()
|
var enemy = load("res://scenes/enemy.tscn").instantiate()
|
||||||
enemy.scale = Vector2.ONE * 0.5
|
enemy.scale = Vector2.ONE * 0.5
|
||||||
enemy.position = Vector2(randi_range(0, get_viewport_rect().size.x), -50)
|
enemy.position = Vector2(randi_range(0, get_viewport_rect().size.x), -50)
|
||||||
enemy.speed *= randf_range(0.5, 2.0)
|
enemy.speed *= randf_range(0.67, 1.5)
|
||||||
enemy.target = playerPos
|
enemy.target = playerPos
|
||||||
|
|
||||||
return enemy
|
return enemy
|
||||||
@ -84,7 +82,11 @@ func _on_spawn_timer_timeout() -> void:
|
|||||||
_spawn_enemies(1)
|
_spawn_enemies(1)
|
||||||
|
|
||||||
|
|
||||||
# TODO: move all quest stuff to quest class
|
# TODO: move all quest stuff to quest class?
|
||||||
func _on_quest_completed() -> void:
|
func _on_quest_completed() -> void:
|
||||||
$SpawnTimer.stop()
|
$SpawnTimer.stop()
|
||||||
questComplete = true
|
# questComplete = true
|
||||||
|
if _get_enemies().is_empty(): # and questComplete:
|
||||||
|
canContinue = true
|
||||||
|
# print("Area Complete!")
|
||||||
|
# get_tree().quit()
|
||||||
|
Loading…
Reference in New Issue
Block a user