fix (i think....) the silly one-way platform issueeee

This commit is contained in:
Haze Weathers 2023-03-08 19:26:09 -05:00
parent 57b341f515
commit 7606485692
5 changed files with 15 additions and 14 deletions

View file

@ -3,8 +3,9 @@
[ext_resource path="res://graphics/moving_platform/moving_platform.png" type="Texture" id=1]
[ext_resource path="res://objects/environment/moving_platform/moving_platform.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 4, 2 )
[sub_resource type="SegmentShape2D" id=1]
a = Vector2( -4, -2 )
b = Vector2( 4, -2 )
[node name="MovingPlatform" type="KinematicBody2D"]
collision_layer = 4

View file

@ -2,11 +2,12 @@ extends Node2D
onready var anims = $AnimationPlayer
onready var flip_timer = $FlipTimer
onready var delay_timer = $DelayTimer
onready var collision_shape = $StaticBody2D/CollisionShape2D
onready var body = $StaticBody2D
export var time:float = 60
export var delay = 0.0
export(int, "Wood", "Yellow") var color
onready var time_ms = time * 0.0166666666666667 # Time is converted from frames @ 60fps to ms
onready var time_ms = time / 60.0 # Time is converted from frames @ 60fps to ms
onready var collision_layer = body.collision_layer
func _ready():
#Auto start if delay variable is zero
@ -33,10 +34,8 @@ func _on_DelayTimer_timeout():
func _on_DetectPlayer_area_entered(area):
if area.is_in_group("player"):
Debug.print("player in")
collision_shape.set_deferred("one_way_collision", true)
body.collision_layer = 0
func _on_DetectPlayer_area_exited(area):
if area.is_in_group("player"):
Debug.print("player out")
collision_shape.set_deferred("one_way_collision", false)
body.collision_layer = collision_layer

View file

@ -43,6 +43,7 @@ var arrowpos = Vector2(5,3)
#Set initial respawn point
func _ready():
$LeftShoe.shape.length = 0.0
Game.respawn_point = global_position
func _physics_process(delta):

View file

@ -36,7 +36,7 @@ extents = Vector2( 2.5, 5 )
extents = Vector2( 2.5, 5 )
[sub_resource type="RayShape2D" id=44]
length = 1.0
length = 0.01
[sub_resource type="Animation" id=29]
resource_name = "climb"
@ -645,12 +645,12 @@ shape = SubResource( 6 )
position = Vector2( 0.5, 5 )
shape = SubResource( 39 )
[node name="CollisionShape2D2" type="CollisionShape2D" parent="." groups=["sword"]]
position = Vector2( 3, 9 )
[node name="LeftShoe" type="CollisionShape2D" parent="." groups=["sword"]]
position = Vector2( -2, 10 )
shape = SubResource( 44 )
[node name="CollisionShape2D3" type="CollisionShape2D" parent="." groups=["sword"]]
position = Vector2( -2, 9 )
[node name="RightShoe" type="CollisionShape2D" parent="." groups=["sword"]]
position = Vector2( 3, 10 )
shape = SubResource( 44 )
[node name="ClimbRay" type="RayCast2D" parent="."]

View file

@ -45,7 +45,7 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[sub_resource type="ConvexPolygonShape2D" id=17]
points = PoolVector2Array( 8, 6, 0, 6, 0, 2, 8, 2 )
points = PoolVector2Array( 8, 2, 0, 2, 0, 2, 8, 2 )
[resource]
0/name = "grass.png 0"