132 lines
4.8 KiB
GDScript
132 lines
4.8 KiB
GDScript
extends Node2D
|
|
|
|
const fadingTime = 0.8
|
|
const zoomingTime = 2.0
|
|
|
|
func _ready():
|
|
var cameraPosition = Dialogic.get_variable("cameraPosition")
|
|
if cameraPosition == "wounded_zoomed":
|
|
self.position = Vector2( - 1900, - 150)
|
|
self.scale = Vector2(2.0, 2.0)
|
|
|
|
if not get_tree().root.has_node("Root"):
|
|
return ;
|
|
|
|
GallerySingleton.AddImage("WoundedDead");
|
|
|
|
Dialogic.set_variable("Room", "1");
|
|
|
|
var boy = Dialogic.get_variable("5_Wounded_Fire")
|
|
match boy:
|
|
"Red":
|
|
$Boy.texture = load("res://resources/graphics/backgrounds/wounded_dead/red.webp")
|
|
$Poduwka.texture = load("res://resources/graphics/backgrounds/wounded_dead/poduwka_red.webp")
|
|
GallerySingleton.AddImage("WoundedDead_Red");
|
|
"White":
|
|
$Boy.texture = load("res://resources/graphics/backgrounds/wounded_dead/white.webp")
|
|
$Poduwka.texture = load("res://resources/graphics/backgrounds/wounded_dead/poduwka_white.webp")
|
|
GallerySingleton.AddImage("WoundedDead_White");
|
|
"Blue_M":
|
|
$Boy.texture = load("res://resources/graphics/backgrounds/wounded_dead/blue.webp")
|
|
$Poduwka.texture = load("res://resources/graphics/backgrounds/wounded_dead/poduwka_blue.webp")
|
|
GallerySingleton.AddImage("WoundedDead_Blue");
|
|
"Gray":
|
|
$Boy.texture = load("res://resources/graphics/backgrounds/wounded_dead/gray.webp")
|
|
$Poduwka.texture = load("res://resources/graphics/backgrounds/wounded_dead/poduwka_gray.webp")
|
|
GallerySingleton.AddImage("WoundedDead_Gray");
|
|
|
|
if int(Dialogic.get_variable("Poduwka")) == 1:
|
|
$Poduwka.visible = true
|
|
else :
|
|
$Poduwka.visible = false
|
|
|
|
var dialogicNode = get_parent().get_parent().get_node("Game").get_child(0).get_child(0)
|
|
dialogicNode.connect("dialogic_signal", self, "_poduwka_listener")
|
|
|
|
|
|
func _poduwka_listener(string):
|
|
match string:
|
|
"podushka_off":
|
|
Dialogic.set_variable("Poduwka", 0)
|
|
$Tween.interpolate_property($Poduwka, "modulate", Color(1, 1, 1, 1), Color(1, 1, 1, 0), fadingTime, Tween.TRANS_LINEAR, 0)
|
|
$Tween.start()
|
|
"zoom_out":
|
|
Dialogic.set_variable("cameraPosition", "1")
|
|
$Tween.remove_all()
|
|
$Tween.interpolate_property(self, "scale", self.scale, Vector2(1.0, 1.0), zoomingTime, Tween.TRANS_LINEAR, 0)
|
|
$Tween.interpolate_property(self, "position", self.position, Vector2(0, 0), zoomingTime, Tween.TRANS_LINEAR, 0)
|
|
$Tween.start()
|
|
|
|
var folder;
|
|
|
|
func InitForGallery()->Array:
|
|
scale = Vector2(0.5, 0.5)
|
|
|
|
$Poduwka.visible = false;
|
|
|
|
var amount = 0;
|
|
var only = "";
|
|
var names = ["WoundedDead_Red", "WoundedDead_White", "WoundedDead_Blue", "WoundedDead_Gray"];
|
|
var res = [];
|
|
|
|
for i in names:
|
|
var unlocked = GallerySingleton.HaveImage(i);
|
|
if unlocked:
|
|
match i:
|
|
"WoundedDead_Red":
|
|
res.push_back("ui_name_red");
|
|
"WoundedDead_White":
|
|
res.push_back("ui_name_white");
|
|
"WoundedDead_Blue":
|
|
res.push_back("ui_name_blue_m");
|
|
"WoundedDead_Gray":
|
|
res.push_back("ui_name_gray");
|
|
amount += 1;
|
|
only = i;
|
|
|
|
if amount == 1:
|
|
var path = "";
|
|
var pillowPath = "";
|
|
match only:
|
|
"WoundedDead_Red":
|
|
path = "res://resources/graphics/backgrounds/wounded_dead/red.webp";
|
|
pillowPath = "res://resources/graphics/backgrounds/wounded_dead/poduwka_red.webp";
|
|
"WoundedDead_White":
|
|
path = "res://resources/graphics/backgrounds/wounded_dead/white.webp";
|
|
pillowPath = "res://resources/graphics/backgrounds/wounded_dead/poduwka_white.webp";
|
|
"WoundedDead_Blue":
|
|
path = "res://resources/graphics/backgrounds/wounded_dead/blue.webp";
|
|
pillowPath = "res://resources/graphics/backgrounds/wounded_dead/poduwka_blue.webp";
|
|
"WoundedDead_Gray":
|
|
path = "res://resources/graphics/backgrounds/wounded_dead/gray.webp";
|
|
pillowPath = "res://resources/graphics/backgrounds/wounded_dead/poduwka_gray.webp";
|
|
$Boy.texture = load(path);
|
|
$Poduwka.texture = load(pillowPath);
|
|
return ["ui_pillow"];
|
|
else :
|
|
var firstCharacter = tr(res[0]);
|
|
SetSettings(firstCharacter)
|
|
res.push_back("ui_pillow");
|
|
return res;
|
|
|
|
func SetSettings(setting):
|
|
if setting == tr("ui_pillow"):
|
|
$Poduwka.visible = not $Poduwka.visible;
|
|
return ;
|
|
|
|
var path = "";
|
|
var pillowPath = "";
|
|
if setting == tr("ui_name_red"):
|
|
path = "res://resources/graphics/backgrounds/wounded_dead/red.webp";
|
|
pillowPath = "res://resources/graphics/backgrounds/wounded_dead/poduwka_red.webp";
|
|
elif setting == tr("ui_name_white"):
|
|
path = "res://resources/graphics/backgrounds/wounded_dead/white.webp";
|
|
pillowPath = "res://resources/graphics/backgrounds/wounded_dead/poduwka_white.webp";
|
|
elif setting == tr("ui_name_blue_m"):
|
|
path = "res://resources/graphics/backgrounds/wounded_dead/blue.webp";
|
|
pillowPath = "res://resources/graphics/backgrounds/wounded_dead/poduwka_blue.webp";
|
|
else :
|
|
path = "res://resources/graphics/backgrounds/wounded_dead/gray.webp";
|
|
pillowPath = "res://resources/graphics/backgrounds/wounded_dead/poduwka_gray.webp";
|
|
$Boy.texture = load(path);
|
|
$Poduwka.texture = load(pillowPath);
|