Adjusted movement and included collider collisions as a constraint to the player

This commit is contained in:
2025-05-11 23:20:35 +02:00
parent 296fed6e08
commit 2a7f39e3fe
4 changed files with 108 additions and 49 deletions
+8 -10
View File
@@ -291,7 +291,7 @@
[ext_resource type="Texture2D" uid="uid://ci7uer5wecm2a" path="res://art/animation/vesna/Back/B02-Walk/0048.png" id="293_ltqas"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ssqtd"]
radius = 200.0
radius = 167.672
[sub_resource type="SpriteFrames" id="SpriteFrames_4yiyq"]
animations = [{
@@ -1191,32 +1191,30 @@ animations = [{
}]
[node name="Player2d" type="Node2D"]
y_sort_enabled = true
[node name="RigidBody2D" type="RigidBody2D" parent="." node_paths=PackedStringArray("_sprite")]
[node name="CharacterBody2D" type="CharacterBody2D" parent="." node_paths=PackedStringArray("_sprite")]
position = Vector2(0, 374)
mass = 0.001
gravity_scale = 0.0
lock_rotation = true
script = ExtResource("1_ssqtd")
_speed = 1000.0
_speed = 750.0
_sprite = NodePath("visuals/Animated Sprites")
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
z_index = 1
y_sort_enabled = true
position = Vector2(-24, -116)
shape = SubResource("CircleShape2D_ssqtd")
debug_color = Color(0.923708, 0.202722, 0.475262, 0.42)
[node name="visuals" type="Node2D" parent="RigidBody2D"]
[node name="visuals" type="Node2D" parent="CharacterBody2D"]
position = Vector2(0, -374)
[node name="Animated Sprites" type="AnimatedSprite2D" parent="RigidBody2D/visuals"]
[node name="Animated Sprites" type="AnimatedSprite2D" parent="CharacterBody2D/visuals"]
position = Vector2(0, 450)
sprite_frames = SubResource("SpriteFrames_4yiyq")
animation = &"side_walking"
offset = Vector2(0, -450)
[node name="Camera2D" type="Camera2D" parent="RigidBody2D"]
[node name="Camera2D" type="Camera2D" parent="CharacterBody2D"]
position = Vector2(26, -469)
zoom = Vector2(0.3, 0.3)