From 64ff2d38dfad7bad20bdf1535f0fa2405fbeaf97 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Fri, 24 Mar 2023 21:22:07 -0400 Subject: [PATCH] better slope handling --- objects/player/player.gd | 3 ++- tilesets/t_station.tres | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/objects/player/player.gd b/objects/player/player.gd index 29f3cc2..aaef557 100644 --- a/objects/player/player.gd +++ b/objects/player/player.gd @@ -101,7 +101,8 @@ func _physics_process(delta): position.y += 1 velocity.y = 0 #Apply velocity - move_and_slide(velocity,Vector2.UP) + var snap = Vector2(0.0, 0.0 if velocity.y < 0.0 else 14.0) + move_and_slide_with_snap(velocity, snap, Vector2.UP, true) #Moon Jump if Debug.moon_jump == true: can_doublejump = true #2011 diff --git a/tilesets/t_station.tres b/tilesets/t_station.tres index 93bb25b..ed8a090 100644 --- a/tilesets/t_station.tres +++ b/tilesets/t_station.tres @@ -8,9 +8,6 @@ points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 ) [sub_resource type="ConvexPolygonShape2D" id=2] points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) -[sub_resource type="ConvexPolygonShape2D" id=3] -points = PoolVector2Array( 8, 8, 2, 8, 5, 6, 8, 4 ) - [sub_resource type="ConvexPolygonShape2D" id=4] points = PoolVector2Array( 8, 8, 0, 8, 0, 4, 8, 0 ) @@ -29,6 +26,9 @@ points = PoolVector2Array( 4, 8, 0, 8, 0, 3, 4, 3 ) [sub_resource type="ConvexPolygonShape2D" id=25] points = PoolVector2Array( 8, 8, 4, 8, 4, 0, 8, 0 ) +[sub_resource type="ConvexPolygonShape2D" id=26] +points = PoolVector2Array( 0, 8, 8, 4, 8, 8, 8, 8 ) + [sub_resource type="ConvexPolygonShape2D" id=5] points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 ) @@ -111,12 +111,6 @@ points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 ) "shape": SubResource( 2 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) }, { -"autotile_coord": Vector2( 2, 1 ), -"one_way": false, -"one_way_margin": 1.0, -"shape": SubResource( 3 ), -"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) -}, { "autotile_coord": Vector2( 3, 1 ), "one_way": false, "one_way_margin": 1.0, @@ -152,6 +146,12 @@ points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 ) "one_way_margin": 1.0, "shape": SubResource( 25 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +}, { +"autotile_coord": Vector2( 2, 1 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 26 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 0/z_index = 0 1/name = "concrete"