One_Eleven_Android/scripts/AlternativeChoices/AlternativeChoiceTimeline_140.gd
2024-11-10 03:34:28 +03:00

174 lines
5.5 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.6", "choice22.5", "choice22.4"];
func SetCursorStates():
cursorStates = [CursorState.Walk, CursorState.Talk, CursorState.Talk, CursorState.Walk, CursorState.Walk, CursorState.Walk, CursorState.Walk, ];
func AdjustLabels():
var goOutside = get_node("Labels/4");
goOutside.rect_global_position = Vector2(goOutside.rect_global_position.x - 10, goOutside.rect_global_position.y - 10);
get_node("Labels/5").rect_global_position.y = get_node("Labels/5").rect_global_position.y - 35;
get_node("Labels/6").rect_global_position.y = get_node("Labels/6").rect_global_position.y - 20;
get_node("Labels/7").rect_global_position.y = get_node("Labels/7").rect_global_position.y - 20;
func CheckForVariables():
get_node("SpriteButtons/Red").visible = Dialogic.get_variable("Is_Red_Dead") == "0";
get_node("SpriteButtons/White").visible = Dialogic.get_variable("Is_White_Dead") == "0";
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_2_button_up():
if not CheckHover():return ;
if Dialogic.get_variable("Timeline144") == "0":
Dialogic.set_variable("PreviousTimelineChoice", "144");
else :
Dialogic.set_variable("PreviousTimelineChoice", "boys");
End()
func _on_4_button_up():
if not CheckHover():return ;
if Dialogic.get_variable("Timeline142") == "0":
Dialogic.set_variable("PreviousTimelineChoice", "142");
else :
Dialogic.set_variable("PreviousTimelineChoice", "boys");
End()
func _on_15_button_up():
if not CheckHover():return ;
Dialogic.set_variable("PreviousTimelineChoice", "141");
End()
func _on_Stairs_button_up():
if not CheckHover():return ;
Dialogic.set_variable("PreviousTimelineChoice", "2nd_floor");
End()
func _on_Garage_button_up():
if not CheckHover():return ;
Dialogic.set_variable("PreviousTimelineChoice", "142_h");
End()
func _on_Basement_button_up():
if not CheckHover():return ;
Dialogic.set_variable("PreviousTimelineChoice", "143");
End()
func _on_Kitchen_button_up():
if not CheckHover():return ;
Dialogic.set_variable("PreviousTimelineChoice", "149");
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;