fix (i think....) the silly one-way platform issueeee
This commit is contained in:
parent
57b341f515
commit
7606485692
5 changed files with 15 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue