platformer-game-test/src/Levels/LevelTemplate/Camera2D.gd
2020-09-14 11:28:03 -04:00

16 lines
323 B
GDScript

extends Camera2D
var _grid_position := Vector2.ZERO
func update_grid_position(new_position):
_grid_position = new_position
pass
func _physics_process(delta: float) -> void:
if position != _grid_position:
position = Vector2(
lerp(position.x, _grid_position.x, .1),
lerp(position.y, _grid_position.y, .1)
)