224 lines
7.1 KiB
GDScript
224 lines
7.1 KiB
GDScript
extends "res://scripts/AlternativeChoices/AlternativeChoiceBase.gd"
|
|
|
|
var cursorRight = preload("res://resources/cursors/man_right.webp")
|
|
var cursorLeft = preload("res://resources/cursors/man_left.webp")
|
|
|
|
var movingLeft = false;
|
|
var movingRight = false;
|
|
const movingSpeed = 310;
|
|
const edgePosition = - 920;
|
|
|
|
func Localization():
|
|
localization = ["", "choice22.8", "", "", "", "", "", "", "", "", "choice22.4", "choice22.5", "choice22.6", ];
|
|
|
|
func AdjustLabels():
|
|
var goOutside = get_node("Labels/2");
|
|
goOutside.rect_global_position = Vector2(goOutside.rect_global_position.x - 10, goOutside.rect_global_position.y - 10);
|
|
get_node("Labels/11").rect_global_position.y = get_node("Labels/11").rect_global_position.y - 20;
|
|
get_node("Labels/12").rect_global_position.y = get_node("Labels/12").rect_global_position.y - 20;
|
|
get_node("Labels/13").rect_global_position.y = 950;
|
|
|
|
func SetCursorStates():
|
|
cursorStates = [CursorState.Walk, CursorState.Walk, CursorState.Talk, CursorState.Talk, CursorState.Talk, CursorState.Talk, CursorState.Talk, CursorState.Talk, CursorState.Talk, CursorState.Talk, CursorState.Walk, CursorState.Walk, CursorState.Walk, ];
|
|
|
|
func CheckForVariables():
|
|
get_node("SpriteButtons/Amanda").visible = s("Is_Pink_Dead") and s("Timeline121_a");
|
|
|
|
get_node("SpriteButtons/White").visible = s("Is_White_Dead")
|
|
get_node("SpriteButtons/Robert").visible = s("Is_Gray_Dead")
|
|
get_node("SpriteButtons/Red").visible = s("Is_Red_Dead")
|
|
get_node("SpriteButtons/Blue_M").visible = s("Is_Blue_M_Dead")
|
|
get_node("SpriteButtons/Black").visible = s("Is_Black_Dead")
|
|
get_node("SpriteButtons/Green").visible = s("Is_Green_Dead")
|
|
get_node("SpriteButtons/Dana").visible = s("Is_Purple_Dead")
|
|
|
|
if Dialogic.get_variable("LightsOn") == "0":
|
|
$SpriteButtons / Garage.texture_normal = load("res://resources/AlternativeChoices/Timeline_120/Door_night.webp");
|
|
|
|
var xPos = int(Dialogic.get_variable("PanoramaPosition"));
|
|
$SpriteButtons.position.x = xPos;
|
|
$Labels.position.x = xPos;
|
|
|
|
|
|
func s(variable:String)->bool:
|
|
return Dialogic.get_variable(variable) == "0";
|
|
|
|
func _on_1_button_up():
|
|
if not CheckHover():return ;
|
|
if s("Timeline121_a"):
|
|
Dialogic.set_variable("PreviousTimelineChoice", "121_a");
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "girls");
|
|
End()
|
|
|
|
func _on_2_button_up():
|
|
if not CheckHover():return ;
|
|
Dialogic.set_variable("PreviousTimelineChoice", "121");
|
|
End()
|
|
|
|
func _on_3_button_up():
|
|
if not CheckHover():return ;
|
|
if s("Timeline122"):
|
|
Dialogic.set_variable("PreviousTimelineChoice", "122");
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "boys");
|
|
End()
|
|
|
|
func _on_4_button_up():
|
|
if not CheckHover():return ;
|
|
if s("Timeline123"):
|
|
Dialogic.set_variable("PreviousTimelineChoice", "123");
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "boys");
|
|
End()
|
|
|
|
func _on_5_button_up():
|
|
if not CheckHover():return ;
|
|
if s("Timeline124"):
|
|
Dialogic.set_variable("PreviousTimelineChoice", "124");
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "boys");
|
|
End()
|
|
|
|
func _on_6_button_up():
|
|
if not CheckHover():return ;
|
|
if s("Timeline125"):
|
|
Dialogic.set_variable("PreviousTimelineChoice", "125");
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "boys");
|
|
End()
|
|
|
|
func _on_7_button_up():
|
|
if not CheckHover():return ;
|
|
if s("Timeline126"):
|
|
Dialogic.set_variable("PreviousTimelineChoice", "126");
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "girls");
|
|
End()
|
|
|
|
func _on_8_button_up():
|
|
if not CheckHover():return ;
|
|
if s("Timeline127"):
|
|
Dialogic.set_variable("PreviousTimelineChoice", "127");
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "girls");
|
|
End()
|
|
|
|
func _on_9_button_up():
|
|
if not CheckHover():return ;
|
|
if s("Timeline128"):
|
|
Dialogic.set_variable("PreviousTimelineChoice", "128");
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "girls");
|
|
End()
|
|
|
|
func _on_Kitchen_button_up():
|
|
if not CheckHover():return ;
|
|
Dialogic.set_variable("PreviousTimelineChoice", "120_r");
|
|
End()
|
|
|
|
func _on_Garage_button_up():
|
|
if not CheckHover():return ;
|
|
Dialogic.set_variable("PreviousTimelineChoice", "120_h");
|
|
End()
|
|
|
|
func _on_13_button_up():
|
|
if not CheckHover():return ;
|
|
Dialogic.set_variable("PreviousTimelineChoice", "stairs");
|
|
End()
|
|
|
|
func _on_Basement_button_up():
|
|
if not CheckHover():return ;
|
|
Dialogic.set_variable("PreviousTimelineChoice", "120_basement");
|
|
End()
|
|
|
|
func _on_LeftMove_mouse_entered():
|
|
if get_tree().root.get_node("Root/Background/Panorama").position.x < 0:
|
|
Input.set_custom_mouse_cursor(cursorLeft)
|
|
movingLeft = true
|
|
$WalkingEffect.play()
|
|
|
|
func _on_LeftMove_mouse_exited():
|
|
Input.set_custom_mouse_cursor(arrowCursor)
|
|
movingLeft = false
|
|
Dialogic.set_variable("PanoramaPosition", get_tree().root.get_node("Root/Background/Panorama").position.x)
|
|
$WalkingEffect.stop()
|
|
|
|
func _on_RightMove_mouse_entered():
|
|
if get_tree().root.get_node("Root/Background/Panorama").position.x > edgePosition:
|
|
Input.set_custom_mouse_cursor(cursorRight, 0, Vector2(50, 0))
|
|
movingRight = true
|
|
$WalkingEffect.play()
|
|
|
|
func _on_RightMove_mouse_exited():
|
|
Input.set_custom_mouse_cursor(arrowCursor)
|
|
movingRight = false
|
|
Dialogic.set_variable("PanoramaPosition", get_tree().root.get_node("Root/Background/Panorama").position.x)
|
|
$WalkingEffect.stop()
|
|
|
|
func _process(delta):
|
|
if not get_tree().root.has_node("Root/Background/Panorama"):
|
|
return ;
|
|
|
|
if get_tree().root.get_node("Root/Background/Panorama").position.x == 0:
|
|
if $MovingControls / LeftMove.visible:
|
|
$MovingControls / LeftMove.visible = false;
|
|
_on_LeftMove_mouse_exited();
|
|
elif get_tree().root.get_node("Root/Background/Panorama").position.x == edgePosition:
|
|
if $MovingControls / RightMove.visible:
|
|
$MovingControls / RightMove.visible = false;
|
|
_on_RightMove_mouse_exited();
|
|
else :
|
|
if not $MovingControls / LeftMove.visible:
|
|
$MovingControls / LeftMove.visible = true
|
|
if not $MovingControls / RightMove.visible:
|
|
$MovingControls / RightMove.visible = true;
|
|
|
|
if movingLeft:
|
|
$SpriteButtons.position.x += delta * movingSpeed
|
|
$Labels.position.x += delta * movingSpeed
|
|
|
|
var back = get_tree().root.get_node("Root/Background/Panorama");
|
|
back.position.x += delta * movingSpeed
|
|
back.UpdateContainerSound(back.position.x);
|
|
if back.position.x > 0:
|
|
back.position.x = 0
|
|
$SpriteButtons.position.x = 0
|
|
$Labels.position.x = 0
|
|
movingLeft = false
|
|
elif movingRight:
|
|
$SpriteButtons.position.x -= delta * movingSpeed
|
|
$Labels.position.x -= delta * movingSpeed
|
|
|
|
var back = get_tree().root.get_node("Root/Background/Panorama");
|
|
back.position.x -= delta * movingSpeed
|
|
back.UpdateContainerSound(back.position.x);
|
|
if back.position.x < edgePosition:
|
|
back.position.x = edgePosition
|
|
$SpriteButtons.position.x = edgePosition
|
|
$Labels.position.x = edgePosition
|
|
movingRight = false
|
|
|
|
if isHovering:
|
|
return ;
|
|
|
|
tempDelta += delta;
|
|
if tempDelta > 0.2:
|
|
tempDelta = 0;
|
|
|
|
if shaderValue <= - 0.05:
|
|
isRising = true
|
|
|
|
if shaderValue >= 0.13:
|
|
isRising = false;
|
|
|
|
if isRising:
|
|
shaderValue += 0.01;
|
|
else :
|
|
shaderValue -= 0.01;
|
|
|
|
var buttons = $SpriteButtons.get_children();
|
|
for i in buttons:
|
|
i.material.set_shader_param("mixing", shaderValue);
|
|
else :
|
|
tempDelta += delta;
|