Makes lots of new screens
This commit is contained in:
28
MainGame.gd
28
MainGame.gd
@@ -4,25 +4,25 @@ extends Node2D
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
func get_scene() -> Scene:
|
||||
return $SceneViewport/background
|
||||
|
||||
# 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)
|
||||
# get_scene().connect("transitioned", Callable($SceneViewport/label, "_on_transitioned"))
|
||||
get_scene().connect("transitioned", Callable(self, "_on_transitioned"))
|
||||
reset_camera(get_scene())
|
||||
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_transitioned(scene):
|
||||
print ("this transitioned")
|
||||
reset_camera(scene)
|
||||
$Node2D/label._on_transitioned(scene)
|
||||
#scene.connect("transitioned", $label, "_on_transitioned")
|
||||
$SceneViewport/label._on_transitioned(scene)
|
||||
#scene.connect("transitioned", $SceneViwport/label, "_on_transitioned")
|
||||
scene.connect("transitioned", Callable(self, "_on_transitioned"))
|
||||
|
||||
@onready var camera:Camera2D = $Node2D/Camera2D
|
||||
@onready var camera:Camera2D = $SceneViewport/Camera2D
|
||||
|
||||
func reset_camera(scene):
|
||||
#$Node2D.scale = Vector2(scene.background_scale, scene.background_scale)
|
||||
@@ -31,22 +31,22 @@ func reset_camera(scene):
|
||||
var height = x.texture.get_height()
|
||||
var far_point = self.to_global(Vector2(x.texture.get_width(), x.texture.get_height() ) * x.get_global_transform())
|
||||
print("FAR POINT IS ", far_point)
|
||||
var bg = $Node2D/background
|
||||
camera.make_current()
|
||||
camera.limit_right = far_point.x
|
||||
camera.limit_bottom=far_point.y
|
||||
$Node2D/background/Graham/RemoteTransform2D.remote_path=camera.get_path()
|
||||
get_scene().get_node("Graham/RemoteTransform2D").remote_path=camera.get_path()
|
||||
camera.reset_smoothing()
|
||||
camera.limit_right = far_point.x
|
||||
camera.limit_bottom =far_point.y
|
||||
camera.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)
|
||||
var player = get_scene().get_node("Graham")
|
||||
var s = get_scene().ego_scale(player)
|
||||
player.scale = Vector2(s, s)
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
$Node2D.push_input(event)
|
||||
$SceneViewport.push_input(event)
|
||||
|
||||
Reference in New Issue
Block a user