convert to general Globals.fade_node use
This commit is contained in:
parent
7ca192026d
commit
79b699887e
@ -13,6 +13,7 @@ script = ExtResource("1_o0k38")
|
||||
goalTotal = 20
|
||||
|
||||
[node name="QuestProgress" type="HBoxContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GoalTypeVal" type="Label" parent="QuestProgress"]
|
||||
@ -36,6 +37,7 @@ layout_mode = 2
|
||||
text = "1"
|
||||
|
||||
[node name="QuestComplete" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
@ -74,7 +74,8 @@ func fade_node(node: Node, direction: String, duration: float) -> void:
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("game_speed_fast"):
|
||||
Engine.time_scale = 10.0
|
||||
if event.is_action_pressed("game_speed_normal"):
|
||||
Engine.time_scale = 1.0
|
||||
if OS.is_debug_build():
|
||||
if event.is_action_pressed("game_speed_fast"):
|
||||
Engine.time_scale = 10.0
|
||||
if event.is_action_pressed("game_speed_normal"):
|
||||
Engine.time_scale = 1.0
|
||||
|
@ -20,6 +20,10 @@ func _ready() -> void:
|
||||
|
||||
# set faction
|
||||
self.faction = Globals.World.Faction.CREATURE
|
||||
|
||||
# randomness
|
||||
# TODO: needs to be random from distribution
|
||||
# var rand_difficulty = NPC.NPCDifficulty.values().pick_random()
|
||||
|
||||
# set health
|
||||
_random_mod_health()
|
||||
@ -37,6 +41,8 @@ func _process(_delta: float) -> void:
|
||||
var enemyFaction = self.faction
|
||||
var enemyTier = self.npcTier
|
||||
# delete node
|
||||
# TODO: add fade out for enemy death, Global func doens't work due to
|
||||
# the node getting freed, await didn't help. reimpliment here in enemy.
|
||||
self.remove_from_group("enemies")
|
||||
self.queue_free()
|
||||
# send signal that I died to be counted, etc.
|
||||
|
@ -21,8 +21,8 @@ func _ready() -> void:
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if questComplete:
|
||||
_quest_progress_hide()
|
||||
_quest_complete_show()
|
||||
Globals.fade_node(%QuestProgress, "out", 0.1)
|
||||
Globals.fade_node(%QuestComplete, "in", 0.1)
|
||||
|
||||
|
||||
func _set_goal_text() -> void:
|
||||
@ -45,14 +45,6 @@ func _quest_goal_check(enemyKillType: Globals.World.Faction) -> void:
|
||||
questComplete = true
|
||||
|
||||
|
||||
func _quest_progress_hide() -> void:
|
||||
$QuestProgress.modulate.a -= 0.05
|
||||
|
||||
|
||||
func _quest_complete_show() -> void:
|
||||
$QuestComplete.modulate.a += 0.05
|
||||
|
||||
|
||||
func _generate_random_quest() -> void:
|
||||
# TODO: generate acutally random quest
|
||||
self.goalType = WorldArea.GoalType.KILL
|
||||
|
@ -46,25 +46,7 @@ func _on_button_test_pressed() -> void:
|
||||
func _on_button_exit_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _continue_button_show() -> void:
|
||||
# %UITop/ContinueButton.modulate.a += 0.05
|
||||
%UITop/ContinueButton.show()
|
||||
while %UITop/ContinueButton.modulate.a < 1:
|
||||
# 50 steps 1/100th of a second apart for a total 1/2 second animation
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
%UITop/ContinueButton.modulate.a += 0.02
|
||||
|
||||
|
||||
func _continue_button_hide() -> void:
|
||||
while %UITop/ContinueButton.modulate.a > 0:
|
||||
# 20 steps 1/100th of a second apart for a total 1/5 second animation
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
%UITop/ContinueButton.modulate.a -= 0.05
|
||||
%UITop/ContinueButton.hide()
|
||||
|
||||
|
||||
|
||||
func _go_next_area() -> void:
|
||||
var prevAreaQuest = currentAreaQuest
|
||||
SignalBus.area_continue_pressed.emit()
|
||||
@ -78,7 +60,7 @@ func _go_next_area() -> void:
|
||||
_create_area()
|
||||
# Globals.debug_print("gna new area created")
|
||||
# _continue_button_hide()
|
||||
Globals.fade_node(%UITop/ContinueButton, "out", 0.5)
|
||||
Globals.fade_node(%UITop/ContinueButton, "out", 0.1)
|
||||
canContinue = false
|
||||
|
||||
|
||||
@ -91,8 +73,7 @@ func _on_quest_completed() -> void:
|
||||
if %UITop/AutoCheck.button_pressed:
|
||||
_go_next_area()
|
||||
else:
|
||||
_continue_button_show()
|
||||
# canContinue = true
|
||||
Globals.fade_node(%UITop/ContinueButton, "in", 0.25)
|
||||
|
||||
|
||||
func _on_continue_button_pressed() -> void:
|
||||
|
@ -1,12 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
@ -1,36 +0,0 @@
|
||||
extends Control
|
||||
|
||||
|
||||
var enemies = Array()
|
||||
@export var debug = false
|
||||
|
||||
|
||||
func _on_button_instantiate_pressed() -> void:
|
||||
var middleX := get_viewport_rect().size.x / 2
|
||||
var upperY := get_viewport_rect().size.y / 4
|
||||
var middleY := get_viewport_rect().size.y / 2
|
||||
for enemy in enemies:
|
||||
remove_child(enemy)
|
||||
|
||||
enemies = []
|
||||
var numEnemies = randi_range(1, 5)
|
||||
for i in range(numEnemies):
|
||||
enemies.append(load("res://scenes/npc.tscn").instantiate())
|
||||
add_child(enemies[i])
|
||||
var posX := int(round((i + 1) * get_viewport_rect().size.x / (numEnemies + 1)))
|
||||
enemies[i].position = Vector2(posX, middleY)
|
||||
enemies[0].get_node("%NPCNameLabel").text = "Test"
|
||||
var bossEnemy = load("res://scenes/npc.tscn").instantiate()
|
||||
bossEnemy.npcDifficulty = NPC.NPCDifficulty.BOSS
|
||||
add_child(bossEnemy)
|
||||
bossEnemy.position = Vector2(middleX, upperY)
|
||||
#print(bossEnemy.npcDifficulty)
|
||||
bossEnemy.scale = Vector2.ONE * 1.6
|
||||
|
||||
|
||||
func _on_button_exit_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
func _ready() -> void:
|
||||
if not debug:
|
||||
$MarginContainer/Menus/DebugMenu.hide()
|
@ -1,22 +0,0 @@
|
||||
extends Control
|
||||
|
||||
|
||||
@onready var styling: Control = $Styling
|
||||
|
||||
|
||||
func _on_exit_button_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_test_button_pressed() -> void:
|
||||
var rand_difficulty = NPC.NPCDifficulty.values().pick_random()
|
||||
var rand_tier = NPC.NPCTier.values().pick_random()
|
||||
var anNPC = NPC.new()
|
||||
%TestNMEMaxHealthVal.text = str(anNPC.maxHealth)
|
||||
#TestEMaxHealthVal.label_settings = LabelSettings.new()
|
||||
%TestNMEName.text = str(NPC.NPCDifficulty.find_key(anNPC.npcDifficulty))
|
||||
%TestNMETierVal.text = str(NPC.NPCTier.find_key(anNPC.npcTier))
|
||||
# style the name label based on the difficulty
|
||||
styling.format_label_difficulty(%TestNMEName, anNPC.npcDifficulty)
|
||||
#anNPC.position = Vector2(64, 64)
|
||||
#add_child(anNPC)
|
Loading…
Reference in New Issue
Block a user