Le z-indexeur est là pour z-indexer tous ces petits gars
Quand il rentre en action il trouve si quelqu'un est en collision Et il prend la hauteur de cette personne et se place au dessus Il est comme ça le zindexeur, il est sans gêne
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class_name Car
|
||||
extends CharacterBody2D
|
||||
|
||||
@export var debugLabel: Label
|
||||
@export var speed = 750 # How fast the car will move (pixels/sec).
|
||||
@onready var animation_tree := $AnimationTree
|
||||
@onready var state_machine := animation_tree.get("parameters/driving/playback") as AnimationNodeStateMachinePlayback
|
||||
@@ -18,8 +19,11 @@ func updateFacingDirectionInAnimationTree():
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
$ZIndexControler/ShapeCast2D.enabled = !$CollisionHorizontal.disabled
|
||||
|
||||
if (targetPosition != null):
|
||||
velocity = (targetPosition - position) * speed * delta;
|
||||
|
||||
move_and_slide()
|
||||
if velocity:
|
||||
last_facing_direction = velocity.normalized()
|
||||
|
||||
Reference in New Issue
Block a user