Work on quest locations and the first, brokedown guildhall scene.
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
class_name Adventurer extends Node
|
||||
|
||||
class Appearance extends Resource:
|
||||
var hair_color : String
|
||||
var hair_type : int
|
||||
var skin_color : String
|
||||
var eye_color : String
|
||||
var eye_type : int
|
||||
|
||||
enum Gender{
|
||||
MASC,
|
||||
@@ -23,7 +17,7 @@ var max_energy : int = 1
|
||||
var level : int = 1
|
||||
var exp : int = 0
|
||||
var job : JobData
|
||||
var appearance : Appearance
|
||||
var appearance : Dictionary
|
||||
var stats : StatBlock
|
||||
var gold : int = 0
|
||||
var quest : Quest
|
||||
@@ -177,11 +171,24 @@ func move_item(from : Vector2, to: Vector2) -> void:
|
||||
|
||||
func generate_appearance(features=null) -> void:
|
||||
if features == null:
|
||||
appearance = Appearance.new()
|
||||
appearance = {
|
||||
"hair":{
|
||||
"color":"",
|
||||
"type":""
|
||||
},
|
||||
"skin":{
|
||||
"color":"",
|
||||
"type":""
|
||||
},
|
||||
"eyes":{
|
||||
"color":"",
|
||||
"type":""
|
||||
}
|
||||
}
|
||||
#TODO: Handle different types of hair and eyes
|
||||
appearance.hair_color = AdventurerPortrait.random_color(ColorVariant.Types.HAIR)
|
||||
appearance.hair.color = AdventurerPortrait.random_color(ColorVariant.Types.HAIR)
|
||||
#appearance.hair_type = randi_range(0,len(job.portrait.hair_types) - 1)
|
||||
appearance.eye_color = AdventurerPortrait.random_color(ColorVariant.Types.EYES)
|
||||
appearance.eyes.color = AdventurerPortrait.random_color(ColorVariant.Types.EYES)
|
||||
#appearance.eye_type = randi_range(0,len(job.portrait.eye_types) - 1)
|
||||
appearance.skin_color = AdventurerPortrait.random_color(ColorVariant.Types.SKIN)
|
||||
appearance.skin.color = AdventurerPortrait.random_color(ColorVariant.Types.SKIN)
|
||||
changed.emit()
|
||||
|
||||
@@ -22,9 +22,29 @@ func add_color_variants(list : Array) -> void:
|
||||
|
||||
|
||||
func set_appearance(appearance) -> void:
|
||||
set_color(ColorVariant.Types.HAIR, appearance.hair_color)
|
||||
set_color(ColorVariant.Types.SKIN, appearance.skin_color)
|
||||
set_color(ColorVariant.Types.EYES, appearance.eye_color)
|
||||
set_color(ColorVariant.Types.HAIR, appearance.hair.color)
|
||||
#set_type(ColorVariant.Types.HAIR, appearance.hair.type)
|
||||
set_color(ColorVariant.Types.SKIN, appearance.skin.color)
|
||||
#set_color(ColorVariant.Types.SKIN, appearance.skin.type)
|
||||
set_color(ColorVariant.Types.EYES, appearance.eyes.color)
|
||||
#set_color(ColorVariant.Types.EYES, appearance.eyes.type)
|
||||
|
||||
func get_random_appearance() -> Dictionary:
|
||||
var app = {
|
||||
"hair":{
|
||||
"type":"",
|
||||
"color": random_color(ColorVariant.Types.HAIR)
|
||||
},
|
||||
"skin":{
|
||||
"type":"",
|
||||
"color": random_color(ColorVariant.Types.SKIN)
|
||||
},
|
||||
"eyes":{
|
||||
"type":"",
|
||||
"color": random_color(ColorVariant.Types.EYES)
|
||||
},
|
||||
}
|
||||
return app
|
||||
|
||||
static func random_color(type : ColorVariant.Types) -> String:
|
||||
var lst
|
||||
|
||||
@@ -1,26 +1,39 @@
|
||||
extends Control
|
||||
|
||||
@onready var firstEdit : TextEdit = %FirstNameEdit
|
||||
@onready var lastEdit : TextEdit = %LastNameEdit
|
||||
@onready var signButton : Button = %SignButton
|
||||
@onready var portraitButton : TextureButton = %PortraitButton
|
||||
|
||||
|
||||
@onready var first_edit : TextEdit = %FirstNameEdit
|
||||
@onready var last_edit : TextEdit = %LastNameEdit
|
||||
@onready var sign_button : Button = %SignButton
|
||||
@onready var portrait_button : TextureButton = %PortraitButton
|
||||
@onready var signature : TextureRect = %Signature
|
||||
@onready var write_sound : AudioStreamPlayer = $AudioStreamPlayer
|
||||
@onready var portrait_customizer = $PortraitCustomizer
|
||||
@onready var portrait : AdventurerPortrait = %HeroPortrait
|
||||
@onready var portrait_container = %PortraitContainer
|
||||
var first_set : bool = false
|
||||
var last_set : bool = false
|
||||
var portrait_set : bool = false
|
||||
|
||||
func validate_signature() -> void:
|
||||
signButton.disabled = !(first_set and last_set and portrait_set)
|
||||
|
||||
func _on_portrait_button_pressed() -> void:
|
||||
#Open the Portrait Screesn
|
||||
sign_button.disabled = !(first_set and last_set and portrait_set)
|
||||
|
||||
func _on_portrait_customized() -> void:
|
||||
Game.player_data.appearance = portrait_customizer.appearance
|
||||
portrait.set_appearance(portrait_customizer.appearance)
|
||||
portrait_container.visible = true
|
||||
portrait_customizer.visible = false
|
||||
portrait_set = true
|
||||
validate_signature()
|
||||
|
||||
|
||||
func _on_portrait_button_pressed() -> void:
|
||||
#Open the Portrait Screen
|
||||
portrait_customizer.visible = true
|
||||
|
||||
|
||||
func _on_first_name_edit_text_changed() -> void:
|
||||
if firstEdit.text != "":
|
||||
if first_edit.text != "":
|
||||
first_set = true
|
||||
else:
|
||||
last_set = true
|
||||
@@ -28,7 +41,7 @@ func _on_first_name_edit_text_changed() -> void:
|
||||
|
||||
|
||||
func _on_last_name_edit_text_changed() -> void:
|
||||
if lastEdit.text != "":
|
||||
if last_edit.text != "":
|
||||
last_set = true
|
||||
else:
|
||||
last_set = false
|
||||
@@ -38,7 +51,7 @@ func update_signature_threshold(value : float) -> void:
|
||||
signature.set_instance_shader_parameter("threshold", value)
|
||||
|
||||
func _on_sign_button_pressed() -> void:
|
||||
signButton.visible = false
|
||||
sign_button.visible = false
|
||||
var tween = create_tween()
|
||||
Game.player_data.name = %FirstNameEdit.text
|
||||
Game.player_data.surname = %LastNameEdit.text
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
extends Control
|
||||
|
||||
@onready var portrait : AdventurerPortrait = $HeroPortrait
|
||||
|
||||
var option = 0
|
||||
var opt_key : String = ""
|
||||
var choices : Array = []
|
||||
var appearance : Dictionary
|
||||
|
||||
signal portrait_customized()
|
||||
|
||||
func _ready() -> void:
|
||||
if Game.player_data.appearance.size() != 0:
|
||||
appearance = Game.player_data.appearance
|
||||
else:
|
||||
appearance = portrait.get_random_appearance()
|
||||
portrait.set_appearance(appearance)
|
||||
choices.resize(portrait.option_sets.size())
|
||||
choices.fill(0)
|
||||
opt_key = portrait.option_sets.keys()[option]
|
||||
@@ -16,7 +25,9 @@ func _on_left_button_pressed() -> void:
|
||||
choices[option] -= 1
|
||||
if choices[option] < 0:
|
||||
choices[option] = portrait.option_sets[opt_key].get_child_count() - 1
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = true
|
||||
var node = portrait.option_sets[opt_key].get_child(choices[option])
|
||||
appearance[opt_key].type = node.name
|
||||
node.visible = true
|
||||
|
||||
|
||||
func _on_right_button_pressed() -> void:
|
||||
@@ -24,8 +35,9 @@ func _on_right_button_pressed() -> void:
|
||||
choices[option] += 1
|
||||
if choices[option] >= portrait.option_sets[opt_key].get_child_count():
|
||||
choices[option] -= portrait.option_sets[opt_key].get_child_count()
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = true
|
||||
pass # Replace with function body.
|
||||
var node = portrait.option_sets[opt_key].get_child(choices[option])
|
||||
appearance[opt_key].type = node.name
|
||||
node.visible = true
|
||||
|
||||
|
||||
func _on_up_button_pressed() -> void:
|
||||
@@ -47,4 +59,19 @@ func _on_down_button_pressed() -> void:
|
||||
|
||||
|
||||
func _on_color_pressed(slot : ColorVariant.Types, col : String) -> void:
|
||||
var key : String
|
||||
match(slot):
|
||||
ColorVariant.Types.SKIN: key = "skin"
|
||||
ColorVariant.Types.HAIR: key = "hair"
|
||||
ColorVariant.Types.EYES: key = "eyes"
|
||||
appearance[key].color = col
|
||||
portrait.set_color(slot, col)
|
||||
|
||||
|
||||
func _on_accept_button_pressed() -> void:
|
||||
portrait_customized.emit()
|
||||
|
||||
|
||||
func _on_random_button_pressed() -> void:
|
||||
appearance = portrait.get_random_appearance()
|
||||
portrait.set_appearance(appearance)
|
||||
|
||||
14
scripts/quest_event_location.gd
Normal file
14
scripts/quest_event_location.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends Control
|
||||
|
||||
var view : QuestView
|
||||
var quest : Quest
|
||||
var event : Quest.Event
|
||||
var speed : float
|
||||
func _ready():
|
||||
position.x = (quest.progress - event.progress_point) * quest.length
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
position.x -= view.base_speed * delta
|
||||
|
||||
func activate(...params):
|
||||
pass
|
||||
1
scripts/quest_event_location.gd.uid
Normal file
1
scripts/quest_event_location.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b0majitpmpdoq
|
||||
@@ -1,5 +1,8 @@
|
||||
class_name QuestSprite extends Control
|
||||
|
||||
|
||||
@onready var lifebar : TextureProgressBar = $LifeBar
|
||||
|
||||
var life : int = 1
|
||||
var max_life : int = 1
|
||||
var energy : int = 1
|
||||
@@ -25,6 +28,7 @@ func attack(target : QuestSprite) -> void:
|
||||
func take_damage(source : QuestSprite, amount : int) -> void:
|
||||
busy.emit()
|
||||
life = clampi(life - amount, 0, max_life)
|
||||
lifebar.value = life * 100 / max_life
|
||||
if life == 0:
|
||||
print("%s killed %s!" % [source.name, name])
|
||||
die(source)
|
||||
|
||||
@@ -14,6 +14,7 @@ func _ready() -> void:
|
||||
exp = data.exp
|
||||
stats = StatBlock.copy(data.stats)
|
||||
gold = data.gold
|
||||
data.changed.connect(_on_questor_changed)
|
||||
|
||||
func _process(delta) -> void:
|
||||
if banner_lag > 0:
|
||||
|
||||
@@ -31,4 +31,9 @@ func _on_add_shift_button_pressed() -> void:
|
||||
|
||||
|
||||
func _on_accept_button_pressed() -> void:
|
||||
var schedule = []
|
||||
for child : ShiftCycle in cycle_list:
|
||||
schedule.append([child.work_shift, child.open_shift])
|
||||
Guild.shift_schedule = schedule
|
||||
Game.switch_dialogue("game_start", "")
|
||||
pass # Replace with function body.
|
||||
|
||||
Reference in New Issue
Block a user