66 lines
1.9 KiB
GDScript
66 lines
1.9 KiB
GDScript
extends Camera2D
|
|
|
|
var zoomArray = [
|
|
Vector2(0.53, 0.53),
|
|
Vector2(0.53, 0.53),
|
|
Vector2(0.33, 0.33),
|
|
Vector2(0.48, 0.48),
|
|
Vector2(0.48, 0.48),
|
|
Vector2(1.0, 1.0),
|
|
Vector2(0.45, 0.45),
|
|
Vector2(0.35, 0.35)
|
|
]
|
|
var positionArray = [
|
|
Vector2(2716, 928),
|
|
Vector2(2800, 1129),
|
|
Vector2(1587, 835),
|
|
Vector2(977, 1076),
|
|
Vector2(1614, 1607),
|
|
Vector2(1920, 1080),
|
|
Vector2(1620, 880),
|
|
Vector2(1290, 960),
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
func ZoomToPosition(positionIndex, scaleX, scaleY, zoomTime):
|
|
var tween = get_node("Tween")
|
|
|
|
var newZoom = zoomArray[positionIndex]
|
|
var newPosition = Vector2(positionArray[positionIndex].x * scaleX, positionArray[positionIndex].y * scaleY)
|
|
tween.interpolate_method(self, "ChangePosition", self.position, newPosition, zoomTime, Tween.TRANS_LINEAR, 0)
|
|
tween.interpolate_method(self, "ChangeZoom", self.zoom, newZoom, zoomTime, Tween.TRANS_LINEAR, 0)
|
|
|
|
|
|
|
|
if positionIndex == 2:
|
|
get_tree().root.get_node("Root").SetSFXforBGMNoFade("res://resources/audio/sfx/shagi_gromkie.ogg")
|
|
tween.start()
|
|
if (positionIndex == 2):
|
|
Dialogic.set_variable("cameraPosition", 5)
|
|
else :
|
|
Dialogic.set_variable("cameraPosition", positionIndex)
|
|
var time = int(Dialogic.get_variable("Time"))
|
|
if (positionIndex == 5) and time <= 45:
|
|
if time > 0 and get_parent().get_node("removables").get_node("Man2").visible == true:
|
|
get_parent().RemoveCharacterSlowly("Man2")
|
|
if time > 15 and get_parent().get_node("removables").get_node("Man1").visible == true:
|
|
get_parent().RemoveCharacterSlowly("Man1")
|
|
|
|
func SetPosition(positionIndex, scaleX, scaleY):
|
|
var newZoom = zoomArray[positionIndex]
|
|
var newPosition = Vector2(positionArray[positionIndex].x * scaleX, positionArray[positionIndex].y * scaleY)
|
|
self.position = newPosition
|
|
self.zoom = newZoom
|
|
|
|
func ChangePosition(newPosition):
|
|
self.position = newPosition
|
|
|
|
func ChangeZoom(newZoom):
|
|
self.zoom = newZoom
|
|
|
|
|
|
func _on_Tween_tween_all_completed():
|
|
get_tree().root.get_node("Root").StopSFX()
|