initial
This commit is contained in:
41
MainGame.gd
Normal file
41
MainGame.gd
Normal file
@@ -0,0 +1,41 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$Node2D/background.connect("transitioned", Callable($label, "_on_transitioned"))
|
||||
$Node2D/background.connect("transitioned", Callable(self, "_on_transitioned"))
|
||||
reset_camera($Node2D/background)
|
||||
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_transitioned(scene):
|
||||
print ("this transitioned")
|
||||
reset_camera(scene)
|
||||
$label._on_transitioned()
|
||||
#scene.connect("transitioned", $label, "_on_transitioned")
|
||||
scene.connect("transitioned", Callable(self, "_on_transitioned"))
|
||||
|
||||
|
||||
func reset_camera(scene):
|
||||
#$Node2D.scale = Vector2(scene.background_scale, scene.background_scale)
|
||||
#var far_point = self.to_global(Vector2(scene.find_child("bg").texture.get_width(), scene.find_child("bg").texture.get_height() ) )
|
||||
var x:Sprite2D = scene.find_child("bg");
|
||||
var far_point = self.to_global(Vector2(x.texture.get_width(), x.texture.get_height() ) * x.get_global_transform())
|
||||
print(far_point)
|
||||
var bg = $Node2D/background
|
||||
$Node2D/background/Graham/Camera2D.limit_right = far_point.x
|
||||
$Node2D/background/Graham/Camera2D.limit_bottom =far_point.y
|
||||
$Node2D/background/Graham/Camera2D.reset_smoothing()
|
||||
|
||||
#$Node2D/background/Graham/Camera2D.reset_smoothing()
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
var s = $Node2D/background.ego_scale($Node2D/background/Graham)
|
||||
$Node2D/background/Graham.scale = Vector2(s, s)
|
||||
Reference in New Issue
Block a user