Interlocking doors

This commit is contained in:
Hamcha 2020-07-07 14:20:04 +02:00
parent ff4767f473
commit 2e8ed847c9
4 changed files with 98 additions and 23 deletions

View file

@ -2,17 +2,24 @@ extends StaticBody2D
class_name GameObjectDoor
export(NodePath) var interlockTargetPath
var interlockTarget: GameObjectDoor = null
onready var activationRange = $ActivationRange as ActivationRange
signal changed(open)
func _ready():
if interlockTargetPath != null:
interlockTarget = get_node_or_null(interlockTargetPath)
if not Engine.editor_hint:
activationRange.visible = true
func set_open(open: bool):
if open:
$Sprite.play("open")
if interlockTarget != null:
interlockTarget.set_open(false)
else:
$Sprite.play("close")

View file

@ -38,10 +38,10 @@ func refresh_sprite():
rot = PI
Direction.LEFT:
$light.region_rect.position = Vector2(96, lit_offset)
rot = PI/2
rot = -PI/2
Direction.RIGHT:
$light.region_rect.position = Vector2(64, lit_offset)
rot = -PI/2
rot = PI/2
$Light2D.rotation = rot
$ActivationRange.rotation = rot

View file

@ -21,7 +21,6 @@ region_rect = Rect2( 32, 0, 32, 32 )
[node name="Light2D" type="Light2D" parent="."]
texture = ExtResource( 1 )
offset = Vector2( 0, -10 )
texture_scale = 3.5
energy = 1.2
mode = 2

File diff suppressed because one or more lines are too long