85 lines
2.1 KiB
GDScript
85 lines
2.1 KiB
GDScript
extends Node2D
|
|
|
|
var thresHold:int = - 4470;
|
|
|
|
func _ready():
|
|
if SettingsSingleton.GetCurrentLanguage() == "en":
|
|
thresHold = - 4440;
|
|
|
|
SetBackground();
|
|
SetAuthorText();
|
|
|
|
|
|
|
|
|
|
|
|
func _input(ev):
|
|
if ev is InputEventKey:
|
|
BackToMenu();
|
|
elif Input.is_mouse_button_pressed(1):
|
|
BackToMenu();
|
|
elif Input.is_mouse_button_pressed(5):
|
|
if ($authors.position.y >= thresHold):
|
|
var newPos = $authors.position.y - 100
|
|
if newPos < thresHold:
|
|
$authors.position.y = thresHold
|
|
else :$authors.position.y -= 100
|
|
elif Input.is_mouse_button_pressed(4):
|
|
if ($authors.position.y <= 0):
|
|
var newPos = $authors.position.y + 100
|
|
if newPos > 0:
|
|
$authors.position.y = 0
|
|
else :$authors.position.y += 100
|
|
|
|
func SetBackground():
|
|
var windowSize = SettingsSingleton.GetCurrectScreenResolutionVector2()
|
|
|
|
$Blur.set_polygon(PoolVector2Array([
|
|
Vector2(0, 0),
|
|
Vector2(0, windowSize.y),
|
|
Vector2(windowSize.x, windowSize.y),
|
|
Vector2(windowSize.x, 0)
|
|
]))
|
|
|
|
var backgroundsSize = Vector2(3840, 2160);
|
|
var scaleX = 1 / float(backgroundsSize.x / windowSize.x);
|
|
var scaleY = 1 / float(backgroundsSize.y / windowSize.y);
|
|
$House.scale = Vector2(scaleX, scaleY);
|
|
|
|
var cloudH = 2160;
|
|
|
|
var cloudScale = windowSize.y * 0.53 / cloudH;
|
|
|
|
$Cloud1.scale = Vector2(cloudScale, cloudScale);
|
|
$Cloud3.scale = Vector2(cloudScale, cloudScale);
|
|
|
|
func SetAuthorText():
|
|
$authors / AuthorText.bbcode_text = tr("ui_authors")
|
|
|
|
|
|
func BackToMenu():
|
|
if not SceneLoader.is_connected("on_scene_loaded", self, "MenuLoaded"):
|
|
SceneLoader.connect("on_scene_loaded", self, "MenuLoaded");
|
|
SceneLoader.load_scene("res://scenes/MainMenu.tscn")
|
|
|
|
func MenuLoaded(obj):
|
|
if obj.path == "res://scenes/MainMenu.tscn":
|
|
if obj.instance != null:
|
|
get_tree().root.add_child(obj.instance);
|
|
|
|
for i in get_tree().root.get_children():
|
|
if i.name == "Credits":
|
|
get_tree().root.remove_child(i);
|
|
break;
|
|
|
|
SceneLoader.disconnect("on_scene_loaded", self, "MenuLoaded");
|
|
|
|
var thanksSeen:bool = false;
|
|
|
|
func _process(delta):
|
|
if ($authors.position.y >= thresHold):
|
|
$authors.position.y -= 30 * delta
|
|
else :
|
|
if thanksSeen == false:
|
|
thanksSeen = true;
|
|
# Steam.set_achievement("Credits");
|