Extensive work on the sideview and initial work on player profiles, inventory display, and renaming adventurerdata vs adventurer to adventurer vs adventurersprite
This commit is contained in:
@@ -15,6 +15,7 @@ var quest : Quest = null
|
||||
var current_event : Quest.Event = null
|
||||
var time_elapsed : float = 0
|
||||
var next_waypoint = 0
|
||||
var failed : bool = false
|
||||
#signal value_changed(value : float)
|
||||
#var min_value
|
||||
#var max_value
|
||||
@@ -29,10 +30,11 @@ func _ready() -> void:
|
||||
hero.position = hero_offset + Vector2(length * bar.value / bar.max_value, 0)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if failed:
|
||||
return
|
||||
if time_elapsed < quest.length:
|
||||
if current_event != null:
|
||||
if current_event.type != Quest.Event.Type.COMBAT:
|
||||
current_event.process(delta)
|
||||
current_event.process(delta)
|
||||
else:
|
||||
time_elapsed += delta
|
||||
progress_quest()
|
||||
@@ -69,7 +71,8 @@ func update_waypoints(value : float) -> void:
|
||||
func start_event(event : Quest.Event, offset : float) -> void:
|
||||
current_event = event
|
||||
current_event.completed.connect(_on_event_complete)
|
||||
current_event.start()
|
||||
current_event.failed.connect(_on_event_failed)
|
||||
current_event.start(quest)
|
||||
event.time_elapsed = offset
|
||||
|
||||
func setup(quest : Quest) -> void:
|
||||
@@ -93,10 +96,26 @@ func progress_quest() -> void:
|
||||
quest.complete()
|
||||
update_waypoints(bar.value)
|
||||
|
||||
func set_fill_color(color : Color) -> void:
|
||||
%Start/Fill.self_modulate = color
|
||||
%End/Fill.self_modulate = color
|
||||
$ProgressBar.tint_progress = color
|
||||
for wp : Waypoint in waypoints:
|
||||
wp.fill_color = color
|
||||
|
||||
func _on_event_complete() -> void:
|
||||
#TODO: Show event message!
|
||||
speech_bubble.show_message("Event complete!")
|
||||
if current_event.type == Quest.Event.Type.COMBAT:
|
||||
quest.questview.unpause_setting()
|
||||
for p : QuestorSprite in current_event.participants:
|
||||
p.set_animation("running")
|
||||
waypoints[next_waypoint].blink(false)
|
||||
next_waypoint += 1
|
||||
current_event = null
|
||||
|
||||
func _on_event_failed() -> void:
|
||||
failed = true
|
||||
set_fill_color(Color.RED)
|
||||
quest.fail()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user