-
-
Save identity2/776ff7abba81f5ba86a525c4fea4a8ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Being called when loaded. | |
func _ready(): | |
screen_size = self.get_viewport_rect().size | |
# Actually scroll the screen. (Update the viewport according to the position of the camera.) | |
func update_viewport(): | |
var canvas_transform = self.get_viewport().get_canvas_transform() | |
canvas_transform.o = -self.get_global_pos() + screen_size / 2.0 | |
self.get_viewport().set_canvas_transform(canvas_transform) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment