a horse, distended

This commit is contained in:
Haze Weathers 2025-07-23 18:25:01 -06:00
parent 30f12832b5
commit abc054d9f6
3 changed files with 82 additions and 30 deletions

View file

@ -0,0 +1,40 @@
extends RigidBody2D
@export var drag_spring: float = 100.0
var held: bool = false
var _drag_point: Vector2 = Vector2.ZERO
func _init() -> void:
freeze_mode = FREEZE_MODE_KINEMATIC
input_pickable = true
input_event.connect(_on_input_event)
func _physics_process(delta: float) -> void:
if held:
global_position = get_global_mouse_position() - (to_global(_drag_point) - global_position)
func _on_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
if event is InputEventMouseButton:
if event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
_start_drag()
if not event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
_end_drag()
func _start_drag() -> void:
held = true
freeze = true
_drag_point = get_local_mouse_position()
func _end_drag() -> void:
held = false
freeze = false
apply_central_impulse(Input.get_last_mouse_velocity())

View file

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

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=9 format=3 uid="uid://bgo5hhh00twsn"]
[gd_scene load_steps=10 format=3 uid="uid://bgo5hhh00twsn"]
[ext_resource type="Texture2D" uid="uid://bnvm2tlvp0h7j" path="res://assets/takyoin.png" id="1_e1cbl"]
[ext_resource type="Script" uid="uid://dp0f60e2t4hwq" path="res://objects/horse/dragable_body.gd" id="1_kafhg"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_ii5g4"]
bounce = 0.5
@ -28,76 +29,82 @@ height = 48.1475
radius = 6.0
height = 56.0886
[node name="Body" type="RigidBody2D"]
physics_material_override = SubResource("PhysicsMaterial_ii5g4")
[node name="TestHorse" type="Node2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
[node name="Body" type="RigidBody2D" parent="."]
physics_material_override = SubResource("PhysicsMaterial_ii5g4")
script = ExtResource("1_kafhg")
[node name="Sprite2D" type="Sprite2D" parent="Body"]
position = Vector2(0, -52)
texture = ExtResource("1_e1cbl")
region_enabled = true
region_rect = Rect2(0, 56, 82, 103)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Body"]
position = Vector2(-3, -53)
shape = SubResource("CapsuleShape2D_l5btf")
[node name="Head" type="RigidBody2D" parent="."]
[node name="Head" type="RigidBody2D" parent="Body"]
position = Vector2(0, -131)
physics_material_override = SubResource("PhysicsMaterial_ii5g4")
linear_velocity = Vector2(50, 0)
script = ExtResource("1_kafhg")
[node name="Sprite2D" type="Sprite2D" parent="Head"]
[node name="Sprite2D" type="Sprite2D" parent="Body/Head"]
texture = ExtResource("1_e1cbl")
region_enabled = true
region_rect = Rect2(0, 0, 82, 56)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Head"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Body/Head"]
position = Vector2(-3, 9)
shape = SubResource("CircleShape2D_701xa")
[node name="NeckJoint" type="PinJoint2D" parent="Head"]
[node name="NeckJoint" type="PinJoint2D" parent="Body/Head"]
position = Vector2(-2, 29)
node_a = NodePath("../..")
node_b = NodePath("..")
angular_limit_lower = -0.349066
angular_limit_upper = 0.349066
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="Head"]
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="Body/Head"]
position = Vector2(-3, -21)
node_a = NodePath("../..")
node_b = NodePath("..")
length = 10.0
rest_length = 1.0
[node name="RightLeg" type="RigidBody2D" parent="."]
[node name="RightLeg" type="RigidBody2D" parent="Body"]
position = Vector2(14, 19)
physics_material_override = SubResource("PhysicsMaterial_ii5g4")
linear_velocity = Vector2(50, 0)
script = ExtResource("1_kafhg")
[node name="RightFoot" type="RigidBody2D" parent="RightLeg"]
[node name="RightFoot" type="RigidBody2D" parent="Body/RightLeg"]
position = Vector2(13, 48)
physics_material_override = SubResource("PhysicsMaterial_ii5g4")
linear_velocity = Vector2(50, 0)
script = ExtResource("1_kafhg")
[node name="Sprite2D" type="Sprite2D" parent="RightLeg/RightFoot"]
[node name="Sprite2D" type="Sprite2D" parent="Body/RightLeg/RightFoot"]
position = Vector2(-5, 10)
texture = ExtResource("1_e1cbl")
region_enabled = true
region_rect = Rect2(48, 211, 30, 51)
[node name="CollisionShape2D" type="CollisionShape2D" parent="RightLeg/RightFoot"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Body/RightLeg/RightFoot"]
position = Vector2(-6, 7)
rotation = -0.0108859
shape = SubResource("CapsuleShape2D_wkonk")
[node name="KneeJoint" type="PinJoint2D" parent="RightLeg/RightFoot"]
[node name="KneeJoint" type="PinJoint2D" parent="Body/RightLeg/RightFoot"]
position = Vector2(-7, -16)
node_a = NodePath("../..")
node_b = NodePath("..")
angular_limit_lower = -0.349066
angular_limit_upper = 0.349066
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="RightLeg/RightFoot"]
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="Body/RightLeg/RightFoot"]
position = Vector2(-6, 39)
rotation = 3.12446
node_a = NodePath("../..")
@ -106,61 +113,64 @@ length = 10.0
rest_length = 1.0
stiffness = 40.0
[node name="Sprite2D" type="Sprite2D" parent="RightLeg"]
[node name="Sprite2D" type="Sprite2D" parent="Body/RightLeg"]
position = Vector2(3, 5)
texture = ExtResource("1_e1cbl")
region_enabled = true
region_rect = Rect2(35.1571, 154.576, 46.0369, 56.7349)
[node name="CollisionShape2D" type="CollisionShape2D" parent="RightLeg"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Body/RightLeg"]
position = Vector2(-2, 5)
rotation = -0.243572
shape = SubResource("CapsuleShape2D_ii5g4")
[node name="HipJoint" type="PinJoint2D" parent="RightLeg"]
[node name="HipJoint" type="PinJoint2D" parent="Body/RightLeg"]
position = Vector2(-8, -23)
node_a = NodePath("../..")
node_b = NodePath("..")
angular_limit_lower = -0.349066
angular_limit_upper = 0.349066
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="RightLeg"]
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="Body/RightLeg"]
position = Vector2(8, 41)
rotation = 2.8015
node_a = NodePath("../..")
node_b = NodePath("..")
length = 10.0
rest_length = 1.0
stiffness = 40.0
[node name="LeftLeg" type="RigidBody2D" parent="."]
[node name="LeftLeg" type="RigidBody2D" parent="Body"]
position = Vector2(-20, 21)
physics_material_override = SubResource("PhysicsMaterial_ii5g4")
linear_velocity = Vector2(50, 0)
script = ExtResource("1_kafhg")
[node name="LeftFoot" type="RigidBody2D" parent="LeftLeg"]
[node name="LeftFoot" type="RigidBody2D" parent="Body/LeftLeg"]
position = Vector2(11, 47)
physics_material_override = SubResource("PhysicsMaterial_ii5g4")
linear_velocity = Vector2(50, 0)
script = ExtResource("1_kafhg")
[node name="Sprite2D" type="Sprite2D" parent="LeftLeg/LeftFoot"]
[node name="Sprite2D" type="Sprite2D" parent="Body/LeftLeg/LeftFoot"]
position = Vector2(-9, 7)
texture = ExtResource("1_e1cbl")
region_enabled = true
region_rect = Rect2(12, 208, 22, 53)
[node name="CollisionShape2D" type="CollisionShape2D" parent="LeftLeg/LeftFoot"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Body/LeftLeg/LeftFoot"]
position = Vector2(-6, 7)
rotation = -0.0108859
shape = SubResource("CapsuleShape2D_3rrt5")
[node name="KneeJoint" type="PinJoint2D" parent="LeftLeg/LeftFoot"]
[node name="KneeJoint" type="PinJoint2D" parent="Body/LeftLeg/LeftFoot"]
position = Vector2(-7, -16)
node_a = NodePath("../..")
node_b = NodePath("..")
angular_limit_lower = -0.349066
angular_limit_upper = 0.349066
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="LeftLeg/LeftFoot"]
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="Body/LeftLeg/LeftFoot"]
position = Vector2(-6, 39)
rotation = 3.12446
node_a = NodePath("../..")
@ -169,28 +179,29 @@ length = 10.0
rest_length = 1.0
stiffness = 40.0
[node name="Sprite2D" type="Sprite2D" parent="LeftLeg"]
[node name="Sprite2D" type="Sprite2D" parent="Body/LeftLeg"]
position = Vector2(3, 2)
texture = ExtResource("1_e1cbl")
region_enabled = true
region_rect = Rect2(15, 154, 18, 55)
[node name="CollisionShape2D" type="CollisionShape2D" parent="LeftLeg"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Body/LeftLeg"]
position = Vector2(3, 2)
rotation = -0.0183865
shape = SubResource("CapsuleShape2D_701xa")
[node name="HipJoint" type="PinJoint2D" parent="LeftLeg"]
[node name="HipJoint" type="PinJoint2D" parent="Body/LeftLeg"]
position = Vector2(3, -24)
node_a = NodePath("../..")
node_b = NodePath("..")
angular_limit_lower = -0.349066
angular_limit_upper = 0.349066
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="LeftLeg"]
[node name="RotationLimiter" type="DampedSpringJoint2D" parent="Body/LeftLeg"]
position = Vector2(3, 39)
rotation = 3.14301
node_a = NodePath("../..")
node_b = NodePath("..")
length = 10.0
rest_length = 1.0
stiffness = 40.0