16 lines
323 B
GDScript3
16 lines
323 B
GDScript3
|
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)
|
||
|
)
|