22 lines
527 B
GDScript
22 lines
527 B
GDScript
extends Camera2D
|
|
|
|
var limitsSet = false
|
|
|
|
func _ready():
|
|
LocationManager.location_changed.connect(set_camera_limits)
|
|
|
|
func _process(delta):
|
|
global_position = GameVariables.player.global_position
|
|
|
|
if !limitsSet:
|
|
set_camera_limits()
|
|
|
|
func set_camera_limits():
|
|
limitsSet = true
|
|
|
|
var currentLocation = LocationManager.currentLocation
|
|
limit_left = currentLocation.leftCameraLimit
|
|
limit_right = currentLocation.rightCameraLimit
|
|
limit_top = currentLocation.upperCameraLimit
|
|
limit_bottom = currentLocation.lowerCameraLimit
|