add platforms with movement and collisions

This commit is contained in:
2025-10-20 13:52:08 +01:00
parent 0015662fad
commit f36faba437
3 changed files with 72 additions and 3 deletions

View File

@@ -1,7 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://cy3dg66pt8abt"]
[gd_scene load_steps=9 format=3 uid="uid://cy3dg66pt8abt"]
[ext_resource type="PackedScene" uid="uid://3wumh6kpw3ai" path="res://scenes/player.tscn" id="1_uwrxv"]
[ext_resource type="Texture2D" uid="uid://0syymy7ijylx" path="res://assets/sprites/world_tileset.png" id="1_yqjtg"]
[ext_resource type="PackedScene" uid="uid://xacwq0rohthg" path="res://scenes/platform.tscn" id="3_lnu2h"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_lnu2h"]
texture = ExtResource("1_yqjtg")
@@ -169,18 +170,68 @@ texture = ExtResource("1_yqjtg")
physics_layer_0/collision_layer = 1
sources/0 = SubResource("TileSetAtlasSource_lnu2h")
[sub_resource type="Animation" id="Animation_lnu2h"]
resource_name = "move"
length = 2.0
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(370, 69), Vector2(481, 69)]
}
[sub_resource type="Animation" id="Animation_lbhrr"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(370, 69)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_iywne"]
_data = {
&"RESET": SubResource("Animation_lbhrr"),
&"move": SubResource("Animation_lnu2h")
}
[node name="Game" type="Node2D"]
[node name="TileMap" type="TileMap" parent="."]
position = Vector2(1, 0)
tile_set = SubResource("TileSet_lbhrr")
format = 2
layer_0/tile_data = PackedInt32Array(262145, 0, 0, 262146, 0, 0, 327681, 0, 1, 393218, 0, 1, 327682, 0, 1, 458756, 393216, 1, 458755, 393216, 1, 458762, 393216, 1, 458761, 393216, 1, 458765, 393216, 1, 458751, 0, 0, 393216, 0, 0, 393219, 393216, 0, 393221, 393216, 0, 524287, 0, 1, 458752, 0, 1, 458753, 0, 1, 524288, 0, 1, 524289, 0, 1, 524290, 0, 1, 524291, 393216, 1, 524293, 393216, 1, 524297, 393216, 1, 524298, 393216, 1, 524301, 393216, 1, 524302, 393216, 1, 393226, 393216, 0, 393225, 393216, 0, 393230, 393216, 0, 65540, 0, 1, 65542, 0, 1, 131079, 0, 1, 131080, 0, 1, 131083, 0, 1, 131085, 0, 1, 131086, 0, 1, 65549, 0, 1, 65548, 0, 1, 5, 0, 1, 6, 0, 1, 4, 0, 0, -65531, 0, 0, -65530, 0, 0, 65543, 0, 0, 65544, 0, 0, 65547, 0, 0, 12, 0, 0, 13, 0, 0, 65550, 0, 0, 393222, 589824, 0, 393223, 655360, 0, 393224, 720896, 0, 131087, 262144, 0, 131088, 262144, 0, 131089, 262144, 0, 196623, 262144, 1, 196624, 262144, 1, 196625, 262144, 1, 262161, 262144, 1, 327698, 262144, 1, 327699, 262144, 1, 327700, 262144, 1, 393236, 262144, 1, 524308, 262144, 1, 196626, 327680, 0, 262163, 327680, 1, 262162, 262144, 1, 262164, 262144, 0, 262165, 262144, 0, 458772, 262144, 1, 327701, 262144, 1, 524309, 262144, 1, 393237, 262144, 1, 131084, 65536, 0, 65541, 65536, 1, 458754, 65536, 1, 589823, 65536, 1, 393217, 65536, 0, 458766, 524288, 0, 524292, 524288, 0, 262172, 131072, 0, 262173, 131072, 0, 327708, 131072, 1, 393244, 131072, 1, 458780, 131072, 1, 524317, 131072, 1, 458781, 131072, 1, 327709, 131072, 1, 393246, 131072, 1, 393247, 131072, 1, 458783, 131072, 1, 524318, 131072, 1, 458782, 131072, 1, 524316, 196608, 1, 393245, 196608, 0, 524319, 196608, 0, 327710, 131072, 0, 327711, 131072, 0, 65545, 589824, 0, 65546, 720896, 0, 393220, 458752, 1, 393229, 458752, 1, -65528, 0, 4, 8, 0, 5, -131064, 0, 4, -196600, 0, 4, -262136, 0, 3, 458773, 327680, 1, 196627, 524288, 5, 131090, 524288, 5, 393215, 65536, 6, 327689, 0, 8, 262174, 524288, 8, 11, 524288, 6, 16, 327680, 4, 65552, 327680, 5, -65520, 327680, 4, -131056, 327680, 3, 458757, 393216, 1)
layer_0/tile_data = PackedInt32Array(262145, 0, 0, 262146, 0, 0, 327681, 0, 1, 393218, 0, 1, 327682, 0, 1, 458756, 393216, 1, 458755, 393216, 1, 458762, 393216, 1, 458761, 393216, 1, 458765, 393216, 1, 458751, 0, 0, 393216, 0, 0, 393219, 393216, 0, 393221, 393216, 0, 524287, 0, 1, 458752, 0, 1, 458753, 0, 1, 524288, 0, 1, 524289, 0, 1, 524290, 0, 1, 524291, 393216, 1, 524293, 393216, 1, 524297, 393216, 1, 524298, 393216, 1, 524301, 393216, 1, 524302, 393216, 1, 393226, 393216, 0, 393225, 393216, 0, 393230, 393216, 0, 65540, 0, 1, 65542, 0, 1, 131079, 0, 1, 131080, 0, 1, 131083, 0, 1, 131085, 0, 1, 131086, 0, 1, 65549, 0, 1, 65548, 0, 1, 5, 0, 1, 6, 0, 1, 4, 0, 0, -65531, 0, 0, -65530, 0, 0, 65543, 0, 0, 65544, 0, 0, 65547, 0, 0, 12, 0, 0, 13, 0, 0, 65550, 0, 0, 393222, 589824, 0, 393223, 655360, 0, 393224, 720896, 0, 131087, 262144, 0, 131088, 262144, 0, 131089, 262144, 0, 196623, 262144, 1, 196624, 262144, 1, 196625, 262144, 1, 262161, 262144, 1, 327698, 262144, 1, 327699, 262144, 1, 327700, 262144, 1, 393236, 262144, 1, 524308, 262144, 1, 196626, 327680, 0, 262163, 327680, 1, 262162, 262144, 1, 262164, 262144, 0, 262165, 262144, 0, 458772, 262144, 1, 327701, 262144, 1, 524309, 262144, 1, 393237, 262144, 1, 131084, 65536, 0, 65541, 65536, 1, 458754, 65536, 1, 589823, 65536, 1, 393217, 65536, 0, 458766, 524288, 0, 524292, 524288, 0, 65545, 589824, 0, 65546, 720896, 0, 393220, 458752, 1, 393229, 458752, 1, -65528, 0, 4, 8, 0, 5, -131064, 0, 4, -196600, 0, 4, -262136, 0, 3, 458773, 327680, 1, 196627, 524288, 5, 131090, 524288, 5, 393215, 65536, 6, 327689, 0, 8, 11, 524288, 6, 16, 327680, 4, 65552, 327680, 5, -65520, 327680, 4, -131056, 327680, 3, 458757, 393216, 1, 327711, 131072, 1, 393247, 131072, 1, 458783, 131072, 1, 524319, 196608, 1, 262175, 131072, 0, 262176, 131072, 0, 327712, 131072, 1, 393248, 196608, 0, 458784, 131072, 1, 524320, 131072, 1, 262177, 524288, 8, 327713, 131072, 0, 393249, 131072, 1, 458785, 131072, 1, 524321, 131072, 1, 327714, 131072, 0, 393250, 131072, 1, 458786, 131072, 1, 524322, 196608, 0)
[node name="Player" parent="." instance=ExtResource("1_uwrxv")]
position = Vector2(33, 49)
position = Vector2(33, 58)
[node name="Camera2D" type="Camera2D" parent="Player"]
position = Vector2(0, -7)
zoom = Vector2(4, 4)
position_smoothing_enabled = true
[node name="Platform" parent="." instance=ExtResource("3_lnu2h")]
position = Vector2(37, 27)
[node name="Platform2" parent="." instance=ExtResource("3_lnu2h")]
position = Vector2(370, 69)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Platform2"]
libraries = {
&"": SubResource("AnimationLibrary_iywne")
}
autoplay = "move"