#5 développement du mouvement du robot et d'une caméra qui le suit

This commit is contained in:
2025-08-01 12:56:59 +02:00
parent 287a7a161f
commit b60c445592
9 changed files with 84 additions and 12 deletions

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dj7gp3crtg2yt"]
[ext_resource type="Script" uid="uid://d1nsr56bh1a1y" path="res://entities/camera/scripts/camera.gd" id="1_y2wxd"]
[node name="Camera" type="Camera2D"]
script = ExtResource("1_y2wxd")

View 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)

View File

@@ -0,0 +1 @@
uid://d1nsr56bh1a1y