Les voitures! Des carrosses à escence.
Et bien les voitures vois-tu, maintenant elles utilisent aussi l'animation tree, le state machine of the future et les super autres magiqueries. Elles bougent grace à un Path2D qui est suivit par un PathFollow2D qui leur sert de lapin. Elles suivent le lapin, sans cesse et sans cesse. Elles sont sage.
This commit is contained in:
13
animations/human/human_blend_tree.tres
Normal file
13
animations/human/human_blend_tree.tres
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[gd_resource type="AnimationNodeBlendTree" load_steps=3 format=3 uid="uid://b3bttga61e3go"]
|
||||||
|
|
||||||
|
[ext_resource type="AnimationNodeStateMachine" uid="uid://ddr1ltkievtku" path="res://animations/human/human_state_machine.tres" id="1_1tkpt"]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_85jde"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
nodes/HumanState/node = ExtResource("1_1tkpt")
|
||||||
|
nodes/HumanState/position = Vector2(133.333, 120)
|
||||||
|
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_85jde")
|
||||||
|
nodes/TimeScale/position = Vector2(453.333, 53.3333)
|
||||||
|
nodes/output/position = Vector2(640, 146.667)
|
||||||
|
node_connections = [&"TimeScale", 0, &"HumanState", &"output", 0, &"TimeScale"]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="AnimationNodeStateMachine" load_steps=19 format=3 uid="uid://ddr1ltkievtku"]
|
[gd_resource type="AnimationNodeStateMachine" load_steps=19 format=3 uid="uid://ddr1ltkievtku"]
|
||||||
|
|
||||||
[ext_resource type="AnimationNodeBlendSpace2D" uid="uid://cy73mgvdr54rh" path="res://animations/human/human_walking_blend.tres" id="1_svxl8"]
|
[ext_resource type="AnimationNodeBlendSpace2D" uid="uid://cy73mgvdr54rh" path="res://animations/human/human_walking_blend.tres" id="1_wk1fq"]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8th2p"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8th2p"]
|
||||||
animation = &"grabbing_left"
|
animation = &"grabbing_left"
|
||||||
@@ -77,12 +77,13 @@ switch_mode = 2
|
|||||||
advance_mode = 2
|
advance_mode = 2
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
|
states/End/position = Vector2(946, 81.8025)
|
||||||
states/Start/position = Vector2(161.333, 82)
|
states/Start/position = Vector2(161.333, 82)
|
||||||
states/grabing/node = SubResource("AnimationNodeBlendSpace2D_8okss")
|
states/grabing/node = SubResource("AnimationNodeBlendSpace2D_8okss")
|
||||||
states/grabing/position = Vector2(629, 81.037)
|
states/grabing/position = Vector2(629, 81.037)
|
||||||
states/idling/node = SubResource("AnimationNodeBlendSpace2D_epue7")
|
states/idling/node = SubResource("AnimationNodeBlendSpace2D_epue7")
|
||||||
states/idling/position = Vector2(383.148, 81.5555)
|
states/idling/position = Vector2(383.148, 81.5555)
|
||||||
states/walking/node = ExtResource("1_svxl8")
|
states/walking/node = ExtResource("1_wk1fq")
|
||||||
states/walking/position = Vector2(382.556, -106.667)
|
states/walking/position = Vector2(382.556, -106.667)
|
||||||
transitions = ["Start", "walking", SubResource("AnimationNodeStateMachineTransition_qfvli"), "walking", "idling", SubResource("AnimationNodeStateMachineTransition_8rhh4"), "idling", "walking", SubResource("AnimationNodeStateMachineTransition_b5dux"), "Start", "idling", SubResource("AnimationNodeStateMachineTransition_8q1xr"), "idling", "grabing", SubResource("AnimationNodeStateMachineTransition_on1es"), "walking", "grabing", SubResource("AnimationNodeStateMachineTransition_pxk2l"), "grabing", "idling", SubResource("AnimationNodeStateMachineTransition_t6jft")]
|
transitions = ["Start", "walking", SubResource("AnimationNodeStateMachineTransition_qfvli"), "walking", "idling", SubResource("AnimationNodeStateMachineTransition_8rhh4"), "idling", "walking", SubResource("AnimationNodeStateMachineTransition_b5dux"), "Start", "idling", SubResource("AnimationNodeStateMachineTransition_8q1xr"), "idling", "grabing", SubResource("AnimationNodeStateMachineTransition_on1es"), "walking", "grabing", SubResource("AnimationNodeStateMachineTransition_pxk2l"), "grabing", "idling", SubResource("AnimationNodeStateMachineTransition_t6jft")]
|
||||||
graph_offset = Vector2(-18, -138)
|
graph_offset = Vector2(-54, -204)
|
||||||
|
|||||||
BIN
assest/vehicules/Car_classic_red_48x48.png
Normal file
BIN
assest/vehicules/Car_classic_red_48x48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
34
assest/vehicules/Car_classic_red_48x48.png.import
Normal file
34
assest/vehicules/Car_classic_red_48x48.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dq81e78eaild8"
|
||||||
|
path="res://.godot/imported/Car_classic_red_48x48.png-6562938659f1241e69dbbb04a65b66b1.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assest/vehicules/Car_classic_red_48x48.png"
|
||||||
|
dest_files=["res://.godot/imported/Car_classic_red_48x48.png-6562938659f1241e69dbbb04a65b66b1.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -12,6 +12,7 @@ height = 48.0
|
|||||||
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_85jde"]
|
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_85jde"]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_iwsa7"]
|
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_iwsa7"]
|
||||||
|
graph_offset = Vector2(0, -54)
|
||||||
nodes/HumanState/node = ExtResource("3_1y7fn")
|
nodes/HumanState/node = ExtResource("3_1y7fn")
|
||||||
nodes/HumanState/position = Vector2(133.333, 120)
|
nodes/HumanState/position = Vector2(133.333, 120)
|
||||||
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_85jde")
|
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_85jde")
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
|
class_name NPCCar
|
||||||
extends PathFollow2D
|
extends PathFollow2D
|
||||||
|
|
||||||
|
@export var car : Car
|
||||||
@export var speed = 0.1
|
@export var speed = 0.1
|
||||||
var voiture
|
@export var distanceMax = 100
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
voiture = (self.get_child(0) as Voiture)
|
|
||||||
voiture.updatePosition(position.x, position.y)
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
progress_ratio += delta * speed;
|
if position.distance_to(car.position) < 200:
|
||||||
voiture.updatePosition(position.x, position.y)
|
progress_ratio += delta * speed;
|
||||||
|
car.moveTo(position);
|
||||||
|
|||||||
51
scenes/sta3CFA.tmp
Normal file
51
scenes/sta3CFA.tmp
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://b4ydi1vv8dvwr"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/world.tscn" id="1_6vs81"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="2_5x6b5"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="3_yuakw"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="4_bqm78"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve2D" id="Curve2D_shblg"]
|
||||||
|
_data = {
|
||||||
|
"points": PackedVector2Array(0, 0, 0, 0, -285, 193, -110.06, 94.1858, 110.06, -94.1858, 52, 134, -159.798, 75.137, 159.798, -75.137, 204, 13, -116.409, -28.5732, 116.409, 28.5732, 2206, -11, -93.6567, -28.0441, 93.6567, 28.0441, 2387, 165, -119.584, 76.7244, 119.584, -76.7244, 2750, 126, 108.472, 48.6803, -108.472, -48.6803, 2737, -309, 122.23, -57.1464, -122.23, 57.1464, 2340, -323, 76.1953, -36.5102, -76.1953, 36.5102, 2167, -129, 107.414, 77.2535, -107.414, -77.2535, 158, -148, 57.4153, 72.8272, -57.4153, -72.8272, 39, -293, 113.137, -95.6951, -113.137, 95.6951, -405, -291, -94.7149, -70.9039, 94.7149, 70.9039, -413, 128, 0, 0, 0, 0, -286, 193, 0, 0, 0, 0, -285, 193)
|
||||||
|
}
|
||||||
|
point_count = 15
|
||||||
|
|
||||||
|
[sub_resource type="Curve2D" id="Curve2D_nircx"]
|
||||||
|
_data = {
|
||||||
|
"points": PackedVector2Array(0, 0, 0, 0, 803, 1569, 0, 0, 0, 0, 910, 1573, 0, 0, 0, 0, 913, 1368, 0, 0, 0, 0, 1926, 1371, 0, 0, 0, 0, 1931, 342, 0, 0, 0, 0, 2082, 333, 0, 0, 0, 0, 2060, -140, 0, 0, 0, 0, 1718, -143, 0, 0, 0, 0, 1724, 20, 0, 0, 0, 0, 900, 30, 0, 0, 0, 0, 904, -1165, 0, 0, 0, 0, -890, -1162, 0, 0, 0, 0, -886, -119, 0, 0, 0, 0, -1062, -106, 0, 0, 0, 0, -1076, 268, 0, 0, 0, 0, -630, 271, 0, 0, 0, 0, -616, 161, 0, 0, 0, 0, 786, 152, 0, 0, 0, 0, 806, 1560)
|
||||||
|
}
|
||||||
|
point_count = 19
|
||||||
|
|
||||||
|
[node name="scene1" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="monde" parent="." instance=ExtResource("1_6vs81")]
|
||||||
|
|
||||||
|
[node name="movibles" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Area2D" parent="movibles" instance=ExtResource("2_5x6b5")]
|
||||||
|
position = Vector2(87, 74)
|
||||||
|
|
||||||
|
[node name="voitures" type="Node" parent="movibles"]
|
||||||
|
|
||||||
|
[node name="Path2D" type="Path2D" parent="movibles/voitures"]
|
||||||
|
position = Vector2(-664, 181)
|
||||||
|
curve = SubResource("Curve2D_shblg")
|
||||||
|
|
||||||
|
[node name="voiture_pnj" parent="movibles/voitures/Path2D" node_paths=PackedStringArray("car") instance=ExtResource("3_yuakw")]
|
||||||
|
position = Vector2(-285, 193)
|
||||||
|
car = NodePath("../Car")
|
||||||
|
|
||||||
|
[node name="Car" parent="movibles/voitures/Path2D" instance=ExtResource("4_bqm78")]
|
||||||
|
position = Vector2(-287, 196)
|
||||||
|
|
||||||
|
[node name="Path2D2" type="Path2D" parent="movibles/voitures"]
|
||||||
|
curve = SubResource("Curve2D_nircx")
|
||||||
|
|
||||||
|
[node name="voiture_pnj" parent="movibles/voitures/Path2D2" node_paths=PackedStringArray("car") instance=ExtResource("3_yuakw")]
|
||||||
|
position = Vector2(803, 1569)
|
||||||
|
car = NodePath("../Car2")
|
||||||
|
speed = 0.05
|
||||||
|
|
||||||
|
[node name="Car2" parent="movibles/voitures/Path2D2" instance=ExtResource("4_bqm78")]
|
||||||
|
position = Vector2(796, 1559)
|
||||||
@@ -1,20 +1,21 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://b4ydi1vv8dvwr"]
|
[gd_scene load_steps=7 format=3 uid="uid://b4ydi1vv8dvwr"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/world.tscn" id="1_6vs81"]
|
[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/world.tscn" id="1_6vs81"]
|
||||||
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="2_5x6b5"]
|
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="2_5x6b5"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="3_yuakw"]
|
[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="3_yuakw"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="4_bqm78"]
|
||||||
|
|
||||||
[sub_resource type="Curve2D" id="Curve2D_shblg"]
|
[sub_resource type="Curve2D" id="Curve2D_shblg"]
|
||||||
_data = {
|
_data = {
|
||||||
"points": PackedVector2Array(0, 0, 0, 0, -411, 81, 0, 0, 0, 0, 37, 81, 0, 0, 0, 0, 37, -34, 0, 0, 0, 0, 2392, -33, 0, 0, 0, 0, 2395, 125, 0, 0, 0, 0, 2750, 126, 0, 0, 0, 0, 2750, -313, 0, 0, 0, 0, 2391, -314, 0, 0, 0, 0, 2390, -149, 0, 0, 0, 0, 39, -144, 0, 0, 0, 0, 39, -293, 0, 0, 0, 0, -398, -289, 0, 0, 0, 0, -409, -310, 0, 0, 0, 0, -414, 78)
|
"points": PackedVector2Array(0, 0, 0, 0, -285, 193, -110.06, 94.1858, 110.06, -94.1858, 52, 134, -159.798, 75.137, 159.798, -75.137, 204, 13, -116.409, -28.5732, 116.409, 28.5732, 2206, -11, -93.6567, -28.0441, 93.6567, 28.0441, 2387, 165, -119.584, 76.7244, 119.584, -76.7244, 2750, 126, 108.472, 48.6803, -108.472, -48.6803, 2737, -309, 122.23, -57.1464, -122.23, 57.1464, 2340, -323, 76.1953, -36.5102, -76.1953, 36.5102, 2167, -129, 107.414, 77.2535, -107.414, -77.2535, 158, -148, 57.4153, 72.8272, -57.4153, -72.8272, 39, -293, 113.137, -95.6951, -113.137, 95.6951, -405, -291, -94.7149, -70.9039, 94.7149, 70.9039, -413, 128, 0, 0, 0, 0, -286, 193, 0, 0, 0, 0, -285, 193)
|
||||||
}
|
}
|
||||||
point_count = 14
|
point_count = 15
|
||||||
|
|
||||||
[sub_resource type="Curve2D" id="Curve2D_nircx"]
|
[sub_resource type="Curve2D" id="Curve2D_nircx"]
|
||||||
_data = {
|
_data = {
|
||||||
"points": PackedVector2Array(0, 0, 0, 0, 803, 1569, 0, 0, 0, 0, 910, 1573, 0, 0, 0, 0, 913, 1368, 0, 0, 0, 0, 1926, 1371, 0, 0, 0, 0, 1931, 342, 0, 0, 0, 0, 2082, 333, 0, 0, 0, 0, 2060, -140, 0, 0, 0, 0, 1718, -143, 0, 0, 0, 0, 1724, 20, 0, 0, 0, 0, 900, 30, 0, 0, 0, 0, 904, -1165, 0, 0, 0, 0, -890, -1162, 0, 0, 0, 0, -886, -119, 0, 0, 0, 0, -1062, -106, 0, 0, 0, 0, -1079, 264, 0, 0, 0, 0, -630, 271, 0, 0, 0, 0, -616, 161, 0, 0, 0, 0, 786, 152, 0, 0, 0, 0, 806, 1560)
|
"points": PackedVector2Array(0, 0, 0, 0, 803, 1569, 0, 0, 0, 0, 910, 1573, 0, 0, 0, 0, 913, 1368, 0, 0, 0, 0, 1926, 1371, 0, 0, 0, 0, 1931, 342, 0, 0, 0, 0, 2082, 333, 0, 0, 0, 0, 2060, -140, 0, 0, 0, 0, 1718, -143, 0, 0, 0, 0, 1649, 73, 0, 0, 0, 0, 814, 68, 0, 0, 0, 0, 897, -123, 0, 0, 0, 0, 904, -1165, 0, 0, 0, 0, -890, -1162, 0, 0, 0, 0, -886, -119, 0, 0, 0, 0, -1062, -106, 0, 0, 0, 0, -1076, 268, 0, 0, 0, 0, -630, 271, 0, 0, 0, 0, -616, 161, 0, 0, 0, 0, 858, 167, 0, 0, 0, 0, 806, 1560)
|
||||||
}
|
}
|
||||||
point_count = 19
|
point_count = 20
|
||||||
|
|
||||||
[node name="scene1" type="Node2D"]
|
[node name="scene1" type="Node2D"]
|
||||||
|
|
||||||
@@ -31,11 +32,24 @@ position = Vector2(87, 74)
|
|||||||
position = Vector2(-664, 181)
|
position = Vector2(-664, 181)
|
||||||
curve = SubResource("Curve2D_shblg")
|
curve = SubResource("Curve2D_shblg")
|
||||||
|
|
||||||
[node name="voiture_pnj" parent="movibles/voitures/Path2D" instance=ExtResource("3_yuakw")]
|
[node name="voiture_pnj" parent="movibles/voitures/Path2D" node_paths=PackedStringArray("car") instance=ExtResource("3_yuakw")]
|
||||||
|
position = Vector2(-285, 193)
|
||||||
|
car = NodePath("../Car")
|
||||||
|
speed = 0.2
|
||||||
|
distanceMax = 200
|
||||||
|
|
||||||
|
[node name="Car" parent="movibles/voitures/Path2D" instance=ExtResource("4_bqm78")]
|
||||||
|
position = Vector2(-287, 196)
|
||||||
|
speed = 500
|
||||||
|
|
||||||
[node name="Path2D2" type="Path2D" parent="movibles/voitures"]
|
[node name="Path2D2" type="Path2D" parent="movibles/voitures"]
|
||||||
curve = SubResource("Curve2D_nircx")
|
curve = SubResource("Curve2D_nircx")
|
||||||
|
|
||||||
[node name="voiture_pnj" parent="movibles/voitures/Path2D2" instance=ExtResource("3_yuakw")]
|
[node name="voiture_pnj" parent="movibles/voitures/Path2D2" node_paths=PackedStringArray("car") instance=ExtResource("3_yuakw")]
|
||||||
position = Vector2(803, 1569)
|
position = Vector2(803, 1569)
|
||||||
speed = 0.05
|
car = NodePath("../Car")
|
||||||
|
distanceMax = 15
|
||||||
|
|
||||||
|
[node name="Car" parent="movibles/voitures/Path2D2" instance=ExtResource("4_bqm78")]
|
||||||
|
position = Vector2(803, 1558)
|
||||||
|
speed = 500
|
||||||
|
|||||||
@@ -1,33 +1,27 @@
|
|||||||
class_name Voiture
|
class_name Car
|
||||||
extends Area2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
var prevPositionX = 0;
|
@export var speed = 750 # How fast the car will move (pixels/sec).
|
||||||
var prevPositionY = 0;
|
@onready var animation_tree := $AnimationTree
|
||||||
|
@onready var state_machine := animation_tree.get("parameters/driving/playback") as AnimationNodeStateMachinePlayback
|
||||||
|
|
||||||
|
var last_facing_direction = Vector2(0,-1) # facing north
|
||||||
|
|
||||||
|
var targetPosition = null
|
||||||
|
|
||||||
|
func moveTo(position: Vector2) -> void:
|
||||||
|
targetPosition = position;
|
||||||
|
|
||||||
|
func updateFacingDirectionInAnimationTree():
|
||||||
|
animation_tree.set("parameters/CarStates/driving/blend_position", last_facing_direction)
|
||||||
|
animation_tree.set("parameters/CarStates/idling/blend_position", last_facing_direction)
|
||||||
|
|
||||||
func updatePosition(x: float, y: float) -> void:
|
|
||||||
var velocityX = prevPositionX - x;
|
|
||||||
var velocityY = prevPositionY - y;
|
|
||||||
$shapeDown.set_deferred("disabled", true);
|
|
||||||
$shapeUp.set_deferred("disabled", true);
|
|
||||||
$shapeLeft.set_deferred("disabled", true);
|
|
||||||
$shapeRight.set_deferred("disabled", true);
|
|
||||||
if(abs(velocityX) > abs(velocityY)):
|
|
||||||
if velocityX > 0 :
|
|
||||||
$AnimatedSprite2D.animation = "driving_left";
|
|
||||||
$shapeLeft.set_deferred("disabled", false);
|
|
||||||
if velocityX < 0 :
|
|
||||||
$AnimatedSprite2D.animation = "driving_right";
|
|
||||||
$shapeRight.set_deferred("disabled", false);
|
|
||||||
if(abs(velocityX) < abs(velocityY)):
|
|
||||||
if velocityY > 0 :
|
|
||||||
$AnimatedSprite2D.animation = "driving_up";
|
|
||||||
$shapeUp.set_deferred("disabled", false);
|
|
||||||
if velocityY < 0 :
|
|
||||||
$AnimatedSprite2D.animation = "driving_down";
|
|
||||||
$shapeDown.set_deferred("disabled", false);
|
|
||||||
prevPositionX = x;
|
|
||||||
prevPositionY = y;
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
$AnimatedSprite2D.play()
|
if (targetPosition != null):
|
||||||
|
velocity = (targetPosition - position) * speed * delta;
|
||||||
|
move_and_slide()
|
||||||
|
if velocity:
|
||||||
|
last_facing_direction = velocity.normalized()
|
||||||
|
|
||||||
|
updateFacingDirectionInAnimationTree()
|
||||||
|
|||||||
@@ -1,241 +1,583 @@
|
|||||||
[gd_scene load_steps=33 format=3 uid="uid://bt1p311rn1h6q"]
|
[gd_scene load_steps=33 format=3 uid="uid://bt1p311rn1h6q"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://vehicules/car.gd" id="1_vkq5y"]
|
[ext_resource type="Script" path="res://vehicules/car.gd" id="1_vkq5y"]
|
||||||
[ext_resource type="Texture2D" uid="uid://55dsls4caujg" path="res://assest/vehicules/Car_classic_red_complete_48x48.png" id="2_ahai6"]
|
[ext_resource type="Texture2D" uid="uid://dq81e78eaild8" path="res://assest/vehicules/Car_classic_red_48x48.png" id="4_0kman"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c5dis1wikcqws" path="res://assest/vehicules/Car_classic_red_complete_48x48_left.png" id="3_tnfoa"]
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8fi8c"]
|
[sub_resource type="Animation" id="Animation_24r8n"]
|
||||||
atlas = ExtResource("2_ahai6")
|
length = 0.001
|
||||||
region = Rect2(3408, 222, 96, 210)
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [0]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tgw3a"]
|
[sub_resource type="Animation" id="Animation_ny3my"]
|
||||||
atlas = ExtResource("2_ahai6")
|
resource_name = "driving_down"
|
||||||
region = Rect2(3504, 222, 96, 210)
|
length = 0.6
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [18, 19, 20, 21, 22, 23]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dj0xl"]
|
[sub_resource type="Animation" id="Animation_o7myv"]
|
||||||
atlas = ExtResource("2_ahai6")
|
resource_name = "driving_left"
|
||||||
region = Rect2(3600, 222, 96, 210)
|
length = 0.6
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [12, 13, 14, 15, 16, 17]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_omrb2"]
|
[sub_resource type="Animation" id="Animation_jej8v"]
|
||||||
atlas = ExtResource("2_ahai6")
|
resource_name = "driving_right"
|
||||||
region = Rect2(3696, 222, 96, 210)
|
length = 0.6
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [0, 1, 2, 3, 4, 5]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_l4q1w"]
|
[sub_resource type="Animation" id="Animation_ns0lb"]
|
||||||
atlas = ExtResource("2_ahai6")
|
resource_name = "driving_up"
|
||||||
region = Rect2(3792, 222, 96, 210)
|
length = 0.6
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [6, 7, 8, 9, 10, 11]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qjaw0"]
|
[sub_resource type="Animation" id="Animation_uyd0m"]
|
||||||
atlas = ExtResource("2_ahai6")
|
resource_name = "idling_down"
|
||||||
region = Rect2(3888, 222, 96, 210)
|
length = 0.1
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [47]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cjmr1"]
|
[sub_resource type="Animation" id="Animation_k8xkk"]
|
||||||
atlas = ExtResource("3_tnfoa")
|
resource_name = "idling_left"
|
||||||
region = Rect2(0, 0, 240, 144)
|
length = 0.1
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [46]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0i1ge"]
|
[sub_resource type="Animation" id="Animation_vk5cn"]
|
||||||
atlas = ExtResource("3_tnfoa")
|
resource_name = "idling_right"
|
||||||
region = Rect2(240, 0, 240, 144)
|
length = 0.1
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [34]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lss5r"]
|
[sub_resource type="Animation" id="Animation_0uy2s"]
|
||||||
atlas = ExtResource("3_tnfoa")
|
resource_name = "opening_door_left"
|
||||||
region = Rect2(480, 0, 240, 144)
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [36, 37, 38, 39, 40, 41, 42, 43, 44, 45]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8ccj1"]
|
[sub_resource type="Animation" id="Animation_goslp"]
|
||||||
atlas = ExtResource("3_tnfoa")
|
resource_name = "opening_door_right"
|
||||||
region = Rect2(720, 0, 240, 144)
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lrp4n"]
|
[sub_resource type="Animation" id="Animation_xch04"]
|
||||||
atlas = ExtResource("3_tnfoa")
|
resource_name = "idling_up"
|
||||||
region = Rect2(960, 0, 240, 144)
|
length = 0.1
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Car/Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [35]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Car/CollisionHorizontal:disabled")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [true]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Car/CollisionVertical:disabled")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qnkpb"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_10pc8"]
|
||||||
atlas = ExtResource("3_tnfoa")
|
_data = {
|
||||||
region = Rect2(1200, 0, 240, 144)
|
"RESET": SubResource("Animation_24r8n"),
|
||||||
|
"driving_down": SubResource("Animation_ny3my"),
|
||||||
|
"driving_left": SubResource("Animation_o7myv"),
|
||||||
|
"driving_right": SubResource("Animation_jej8v"),
|
||||||
|
"driving_up": SubResource("Animation_ns0lb"),
|
||||||
|
"idling_down": SubResource("Animation_uyd0m"),
|
||||||
|
"idling_left": SubResource("Animation_k8xkk"),
|
||||||
|
"idling_right": SubResource("Animation_vk5cn"),
|
||||||
|
"idling_up": SubResource("Animation_xch04"),
|
||||||
|
"opening_door_left": SubResource("Animation_0uy2s"),
|
||||||
|
"opening_door_right": SubResource("Animation_goslp")
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n03o5"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_btgy7"]
|
||||||
atlas = ExtResource("2_ahai6")
|
animation = &"driving_left"
|
||||||
region = Rect2(0, 192, 240, 144)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3k4i1"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d53q5"]
|
||||||
atlas = ExtResource("2_ahai6")
|
animation = &"driving_right"
|
||||||
region = Rect2(240, 192, 240, 144)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pg1lo"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_22qxt"]
|
||||||
atlas = ExtResource("2_ahai6")
|
animation = &"driving_up"
|
||||||
region = Rect2(480, 192, 240, 144)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3b1y7"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_o21fb"]
|
||||||
atlas = ExtResource("2_ahai6")
|
animation = &"driving_down"
|
||||||
region = Rect2(720, 192, 240, 144)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1jisb"]
|
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_6rjtg"]
|
||||||
atlas = ExtResource("2_ahai6")
|
blend_point_0/node = SubResource("AnimationNodeAnimation_btgy7")
|
||||||
region = Rect2(960, 192, 240, 144)
|
blend_point_0/pos = Vector2(-1, 0)
|
||||||
|
blend_point_1/node = SubResource("AnimationNodeAnimation_d53q5")
|
||||||
|
blend_point_1/pos = Vector2(1, 0)
|
||||||
|
blend_point_2/node = SubResource("AnimationNodeAnimation_22qxt")
|
||||||
|
blend_point_2/pos = Vector2(0, -1)
|
||||||
|
blend_point_3/node = SubResource("AnimationNodeAnimation_o21fb")
|
||||||
|
blend_point_3/pos = Vector2(0, 1)
|
||||||
|
blend_mode = 2
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4lngy"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_3fbcc"]
|
||||||
atlas = ExtResource("2_ahai6")
|
animation = &"idling_left"
|
||||||
region = Rect2(1200, 192, 240, 144)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xng4i"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_11mhe"]
|
||||||
atlas = ExtResource("2_ahai6")
|
animation = &"idling_right"
|
||||||
region = Rect2(1440, 210, 96, 210)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yy3vy"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6x8m6"]
|
||||||
atlas = ExtResource("2_ahai6")
|
animation = &"idling_down"
|
||||||
region = Rect2(1536, 210, 96, 210)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cax1g"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ogtbq"]
|
||||||
atlas = ExtResource("2_ahai6")
|
animation = &"idling_up"
|
||||||
region = Rect2(1632, 210, 96, 210)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6dv7n"]
|
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_csi6s"]
|
||||||
atlas = ExtResource("2_ahai6")
|
blend_point_0/node = SubResource("AnimationNodeAnimation_3fbcc")
|
||||||
region = Rect2(1728, 210, 96, 210)
|
blend_point_0/pos = Vector2(-1, 0)
|
||||||
|
blend_point_1/node = SubResource("AnimationNodeAnimation_11mhe")
|
||||||
|
blend_point_1/pos = Vector2(1, 0)
|
||||||
|
blend_point_2/node = SubResource("AnimationNodeAnimation_6x8m6")
|
||||||
|
blend_point_2/pos = Vector2(0, 1)
|
||||||
|
blend_point_3/node = SubResource("AnimationNodeAnimation_ogtbq")
|
||||||
|
blend_point_3/pos = Vector2(0, -1)
|
||||||
|
blend_mode = 2
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7f8f4"]
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4uk5k"]
|
||||||
atlas = ExtResource("2_ahai6")
|
advance_mode = 2
|
||||||
region = Rect2(1824, 210, 96, 210)
|
advance_expression = "velocity"
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vy1dr"]
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_3q86p"]
|
||||||
atlas = ExtResource("2_ahai6")
|
advance_mode = 2
|
||||||
region = Rect2(1920, 210, 96, 210)
|
advance_expression = "!velocity"
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_77j28"]
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0fk7h"]
|
||||||
animations = [{
|
advance_mode = 2
|
||||||
"frames": [{
|
advance_expression = "!velocity"
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_8fi8c")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_tgw3a")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_dj0xl")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_omrb2")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_l4q1w")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_qjaw0")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"driving_down",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_cjmr1")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_0i1ge")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_lss5r")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_8ccj1")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_lrp4n")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_qnkpb")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"driving_left",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_n03o5")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_3k4i1")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_pg1lo")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_3b1y7")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_1jisb")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_4lngy")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"driving_right",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_xng4i")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_yy3vy")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_cax1g")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_6dv7n")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_7f8f4")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_vy1dr")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"driving_up",
|
|
||||||
"speed": 5.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_5yhvy"]
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_6jgtk"]
|
||||||
radius = 35.5
|
advance_mode = 2
|
||||||
height = 158.0
|
advance_expression = "velocity"
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bevht"]
|
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_tnex5"]
|
||||||
radius = 38.0026
|
states/Start/position = Vector2(192, 89.5556)
|
||||||
height = 150.043
|
states/driving/node = SubResource("AnimationNodeBlendSpace2D_6rjtg")
|
||||||
|
states/driving/position = Vector2(460.667, -34.6667)
|
||||||
|
states/idling/node = SubResource("AnimationNodeBlendSpace2D_csi6s")
|
||||||
|
states/idling/position = Vector2(459.111, 88.6667)
|
||||||
|
transitions = ["Start", "driving", SubResource("AnimationNodeStateMachineTransition_4uk5k"), "Start", "idling", SubResource("AnimationNodeStateMachineTransition_3q86p"), "driving", "idling", SubResource("AnimationNodeStateMachineTransition_0fk7h"), "idling", "driving", SubResource("AnimationNodeStateMachineTransition_6jgtk")]
|
||||||
|
graph_offset = Vector2(80, -182)
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_w52g8"]
|
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_5fwej"]
|
||||||
radius = 29.0752
|
|
||||||
height = 172.0
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_j5vcu"]
|
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_q5j17"]
|
||||||
radius = 33.0
|
graph_offset = Vector2(-249.333, -55.3333)
|
||||||
height = 174.0
|
nodes/CarStates/node = SubResource("AnimationNodeStateMachine_tnex5")
|
||||||
|
nodes/CarStates/position = Vector2(-133.333, 173.333)
|
||||||
|
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_5fwej")
|
||||||
|
nodes/TimeScale/position = Vector2(120, 120)
|
||||||
|
node_connections = [&"TimeScale", 0, &"CarStates", &"output", 0, &"TimeScale"]
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_l8rwt"]
|
||||||
position = Vector2(-664, 181)
|
radius = 31.0
|
||||||
|
height = 160.0
|
||||||
|
|
||||||
|
[node name="Car" type="CharacterBody2D"]
|
||||||
|
motion_mode = 1
|
||||||
script = ExtResource("1_vkq5y")
|
script = ExtResource("1_vkq5y")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
rotation = -0.00268924
|
texture = ExtResource("4_0kman")
|
||||||
sprite_frames = SubResource("SpriteFrames_77j28")
|
hframes = 12
|
||||||
animation = &"driving_right"
|
vframes = 4
|
||||||
autoplay = "driving_right"
|
|
||||||
|
|
||||||
[node name="shapeDown" type="CollisionShape2D" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
position = Vector2(1.5, 16)
|
root_node = NodePath("../..")
|
||||||
shape = SubResource("CapsuleShape2D_5yhvy")
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_10pc8")
|
||||||
|
}
|
||||||
|
|
||||||
[node name="shapeUp" type="CollisionShape2D" parent="."]
|
[node name="AnimationTree" type="AnimationTree" parent="."]
|
||||||
position = Vector2(1, -20)
|
root_node = NodePath("../..")
|
||||||
rotation = -0.00268924
|
tree_root = SubResource("AnimationNodeBlendTree_q5j17")
|
||||||
shape = SubResource("CapsuleShape2D_bevht")
|
advance_expression_base_node = NodePath("..")
|
||||||
|
anim_player = NodePath("../AnimationPlayer")
|
||||||
|
parameters/CarStates/driving/blend_position = Vector2(0.0425786, -0.23119)
|
||||||
|
parameters/CarStates/idling/blend_position = Vector2(-0.000397921, -0.120715)
|
||||||
|
parameters/TimeScale/scale = 1.0
|
||||||
|
|
||||||
[node name="shapeLeft" type="CollisionShape2D" parent="."]
|
[node name="CollisionHorizontal" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(-29, 29)
|
position = Vector2(-4, 28)
|
||||||
rotation = 1.5708
|
rotation = 1.5708
|
||||||
shape = SubResource("CapsuleShape2D_w52g8")
|
shape = SubResource("CapsuleShape2D_l8rwt")
|
||||||
|
|
||||||
[node name="shapeRight" type="CollisionShape2D" parent="."]
|
[node name="CollisionVertical" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(28, 27)
|
position = Vector2(1, 2)
|
||||||
rotation = 1.5708
|
rotation = -3.14159
|
||||||
shape = SubResource("CapsuleShape2D_j5vcu")
|
shape = SubResource("CapsuleShape2D_l8rwt")
|
||||||
|
|||||||
@@ -1,20 +1,9 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://cl201baro5y5"]
|
[gd_scene load_steps=2 format=3 uid="uid://cl201baro5y5"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/pathFollow.gd" id="1_fbnn2"]
|
[ext_resource type="Script" path="res://scenes/pathFollow.gd" id="1_fbnn2"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="2_4yiv6"]
|
|
||||||
|
|
||||||
[node name="voiture_pnj" type="PathFollow2D"]
|
[node name="voiture_pnj" type="PathFollow2D"]
|
||||||
position = Vector2(-411, 81)
|
position = Vector2(-411, 81)
|
||||||
rotates = false
|
rotates = false
|
||||||
script = ExtResource("1_fbnn2")
|
script = ExtResource("1_fbnn2")
|
||||||
|
speed = 1.0
|
||||||
[node name="voiture" parent="." instance=ExtResource("2_4yiv6")]
|
|
||||||
position = Vector2(-1, 0)
|
|
||||||
|
|
||||||
[node name="RayCast2D" type="RayCast2D" parent="."]
|
|
||||||
position = Vector2(1, 0)
|
|
||||||
target_position = Vector2(297, 58)
|
|
||||||
|
|
||||||
[node name="RayCast2D2" type="RayCast2D" parent="."]
|
|
||||||
position = Vector2(1, 49)
|
|
||||||
target_position = Vector2(298, -47)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user