15 lines
497 B
GDScript
15 lines
497 B
GDScript
extends Camera2D
|
|
|
|
@onready var player : CharacterBody2D = $".."
|
|
|
|
@export var camera_speed : float = 6.0
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
pass # Replace with function body.
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _physics_process(delta: float) -> void:
|
|
position.x = lerp(position.x, player.position.x, camera_speed * delta)
|
|
position.y = lerp(position.y, player.position.y, camera_speed * delta)
|
|
|