feat: blobby doesn't hang on wall when close to the ground

This commit is contained in:
Jakob Feldmann 2024-01-28 17:54:01 +01:00
parent 54c4ef6aa3
commit 135817c8af
2 changed files with 42 additions and 10 deletions

View File

@ -8,6 +8,7 @@ export(String, FILE) var death_sound_2 := "res://assets/sounds/MONSTER_Cry_mono.
#TODO Switch to new unique node name method for referencing
onready var left_wall_raycasts = $WallRaycasts/LeftWallRaycast
onready var right_wall_raycasts = $WallRaycasts/RightWallRaycast
onready var to_ground_raycast: RayCast2D = $"%ToGroundRaycast"
onready var effect_player = $BlobbyActionEffects/AnimationPlayer
onready var scene_audio = $SceneAudio
@ -377,7 +378,7 @@ func calculate_wallslide_velocity(
delta
)
# Slowed fall/slide on wall
elif wall_hang_time <= player_state_machine.state_time:
elif wall_hang_time <= player_state_machine.state_time || to_ground_raycast.is_colliding():
# TODO dont put constants in here
linear_velocity.y = PhysicsFunc.two_step_euler(
linear_velocity.y * wall_friction, _gravity * mass, mass, delta

View File

@ -11,7 +11,7 @@
[ext_resource path="res://src/Utilities/SceneAudio.tscn" type="PackedScene" id=9]
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 10.4505, 13.5399 )
extents = Vector2( 5.94585, 15.0126 )
[sub_resource type="StreamTexture" id=62]
load_path = "res://.import/blobby-spritesheet.png-205c8efc79bec685345a637ed2dcfc9b.stex"
@ -350,7 +350,7 @@ graph_offset = Vector2( 947.54, 222.569 )
[sub_resource type="AnimationNodeStateMachinePlayback" id=48]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 10.531, 10 )
extents = Vector2( 6.01, 10 )
[sub_resource type="Animation" id=17]
length = 0.001
@ -4053,6 +4053,18 @@ tracks/10/keys = {
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}
tracks/11/type = "value"
tracks/11/path = NodePath("../ToGroundRaycast:position")
tracks/11/interp = 1
tracks/11/loop_wrap = true
tracks/11/imported = false
tracks/11/enabled = true
tracks/11/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -12, 0 ) ]
}
[sub_resource type="Animation" id=97]
resource_name = "wallslidingRight"
@ -4190,6 +4202,18 @@ tracks/10/keys = {
"update": 0,
"values": [ Vector2( -1, 1 ) ]
}
tracks/11/type = "value"
tracks/11/path = NodePath("../ToGroundRaycast:position")
tracks/11/interp = 1
tracks/11/loop_wrap = true
tracks/11/imported = false
tracks/11/enabled = true
tracks/11/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 12, 0 ) ]
}
[sub_resource type="CanvasItemMaterial" id=202]
particles_animation = true
@ -4379,7 +4403,7 @@ process_priority = -1
collision_mask = 254
[node name="CollisionPolygon2D" type="CollisionShape2D" parent="BlobbySkin"]
position = Vector2( -2.48624, -13.4786 )
position = Vector2( -7, -14.951 )
scale = Vector2( 1.03, 1.04 )
shape = SubResource( 2 )
@ -4401,7 +4425,7 @@ position = Vector2( 0, -16 )
texture = SubResource( 62 )
hframes = 6
vframes = 6
frame = 26
frame = 25
__meta__ = {
"_editor_description_": "YXNlcHJpdGVfd2l6YXJkX2NvbmZpZwpwbGF5ZXJ8PUJsb2JieVNwcml0ZS9CbG9iYnltYXRpb25QbGF5ZXIKc291cmNlfD1yZXM6Ly9hc3NldHMvYmxvYmJ5L2Jsb2JieS1zcHJpdGVzaGVldHQuYXNlcHJpdGUKbGF5ZXJ8PUJsb2JieQpvcF9leHB8PUZhbHNlCm9fZm9sZGVyfD0Kb19uYW1lfD0Kb25seV92aXNpYmxlfD1GYWxzZQpvX2V4X3B8PQo="
}
@ -4512,7 +4536,7 @@ scale = Vector2( 0.48, 0.48 )
[node name="BlobbyBody" type="CollisionShape2D" parent="." groups=["player"]]
unique_name_in_owner = true
position = Vector2( -2.514, -10 )
position = Vector2( -7, -10 )
shape = SubResource( 1 )
[node name="WallRaycasts" type="Node2D" parent="."]
@ -4521,13 +4545,13 @@ position = Vector2( 0, -1 )
[node name="LeftWallRaycast" type="Node2D" parent="WallRaycasts"]
[node name="Left_Wallcast1" type="RayCast2D" parent="WallRaycasts/LeftWallRaycast"]
position = Vector2( -11.5, -15 )
position = Vector2( -13, -15.351 )
enabled = true
cast_to = Vector2( -5, 0 )
collision_mask = 40
[node name="Left_Wallcast2" type="RayCast2D" parent="WallRaycasts/LeftWallRaycast"]
position = Vector2( -11.5, -7.751 )
position = Vector2( -13, -7.751 )
enabled = true
cast_to = Vector2( -5, 0 )
collision_mask = 40
@ -4535,17 +4559,24 @@ collision_mask = 40
[node name="RightWallRaycast" type="Node2D" parent="WallRaycasts"]
[node name="Right_Wallcast1" type="RayCast2D" parent="WallRaycasts/RightWallRaycast"]
position = Vector2( 5.5, -15.351 )
position = Vector2( -1, -15.351 )
enabled = true
cast_to = Vector2( 5, 0 )
collision_mask = 40
[node name="Right_Wallcast2" type="RayCast2D" parent="WallRaycasts/RightWallRaycast"]
position = Vector2( 5.5, -7.751 )
position = Vector2( -1, -7.751 )
enabled = true
cast_to = Vector2( 5, 0 )
collision_mask = 40
[node name="ToGroundRaycast" type="RayCast2D" parent="."]
unique_name_in_owner = true
position = Vector2( -12, 0 )
enabled = true
cast_to = Vector2( 0, 32 )
collision_mask = 8
[node name="SlopeRaycastLeft" type="RayCast2D" parent="."]
visible = false
position = Vector2( -9, 0 )