#5 développement du mouvement du robot et d'une caméra qui le suit
This commit is contained in:
11
entities/camera/scripts/camera.gd
Normal file
11
entities/camera/scripts/camera.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Camera2D
|
||||
class_name Camera
|
||||
|
||||
const LERP_WEIGHT = 0.9
|
||||
|
||||
@export var following : Node2D
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if following:
|
||||
global_position = following.global_position.lerp(global_position, LERP_WEIGHT)
|
||||
Reference in New Issue
Block a user