Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://godotforums.org/discussion/25030/how-do-i-vertically-align-the-viewport-to-not-the-top-when-it-becomes-bigger-than-its-limits
- # https://archive.is/vFXJP
- extends Camera2D
- # -1 = Top
- # >-1 and <-0.5 = Range between Top and Middle
- # -0.5 = Middle
- # >-0.5 and <0 = Range between Middle and Bottom
- # 0 (Or better remove the script) = Bottom
- export (float) var cam_extension_direction_y = -0.5
- onready var camera = get_node(".")
- func _process(_delta):
- align_view()
- func align_view():
- if get_viewport_rect().size.y > camera.limit_bottom:
- camera.limit_top = ( get_viewport_rect().size.y- camera.limit_bottom ) * cam_extension_direction_y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement