|
|
|
extends Node2D
|
|
|
|
onready var player = get_node("../Player")
|
|
|
|
onready var covers = get_node("../Covers")
|
|
|
|
onready var furniture = get_node("../Rooms")
|
|
|
|
|
|
|
|
# Declare member variables here. Examples:
|
|
|
|
|
|
|
|
var areamap = {'living':[0],
|
|
|
|
'bedtop':[1,2],
|
|
|
|
'bedtopmid':[2,3],
|
|
|
|
'bedbotmid':[3,4],
|
|
|
|
'bedbot':[4,5],
|
|
|
|
'bathtop':[6],
|
|
|
|
'bathbot':[7]}
|
|
|
|
|
|
|
|
func hide_cover(xs):
|
|
|
|
for x in xs:
|
|
|
|
var cover = covers.get_child(x)
|
|
|
|
cover.hide()
|
|
|
|
|
|
|
|
func show_cover(xs):
|
|
|
|
for x in xs:
|
|
|
|
var cover = covers.get_child(x)
|
|
|
|
cover.show()
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
|
|
|
covers.show()
|
|
|
|
for i in furniture.get_child_count():
|
|
|
|
furniture.get_child(i).hide()
|
|
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
func _process(delta):
|
|
|
|
pass
|
|
|
|
|
|
|
|
func _on_Living_body_entered(body):
|
|
|
|
if body == player:
|
|
|
|
hide_cover(areamap['living'])
|
|
|
|
furniture.get_node("Living").show()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_Living_body_exited(body):
|
|
|
|
if body == player:
|
|
|
|
show_cover(areamap['living'])
|
|
|
|
furniture.get_node("Living").hide()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BedTop_body_entered(body):
|
|
|
|
if body == player:
|
|
|
|
hide_cover(areamap['bedtop'])
|
|
|
|
furniture.get_node("BedTop").show()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BedTop_body_exited(body):
|
|
|
|
if body == player:
|
|
|
|
show_cover(areamap['bedtop'])
|
|
|
|
furniture.get_node("BedTop").hide()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BedTopMid_body_entered(body):
|
|
|
|
if body == player:
|
|
|
|
hide_cover(areamap['bedtopmid'])
|
|
|
|
furniture.get_node("BedTopMid").show()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BedTopMid_body_exited(body):
|
|
|
|
if body == player:
|
|
|
|
show_cover(areamap['bedtopmid'])
|
|
|
|
furniture.get_node("BedTopMid").hide()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BedBotMid_body_entered(body):
|
|
|
|
if body == player:
|
|
|
|
hide_cover(areamap['bedbotmid'])
|
|
|
|
furniture.get_node("BedBotMid").show()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BedBotMid_body_exited(body):
|
|
|
|
if body == player:
|
|
|
|
show_cover(areamap['bedbotmid'])
|
|
|
|
furniture.get_node("BedBotMid").hide()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BedBot_body_entered(body):
|
|
|
|
if body == player:
|
|
|
|
hide_cover(areamap['bedbot'])
|
|
|
|
furniture.get_node("BedBot").show()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BedBot_body_exited(body):
|
|
|
|
if body == player:
|
|
|
|
show_cover(areamap['bedbot'])
|
|
|
|
furniture.get_node("BedBot").hide()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BathTop_body_entered(body):
|
|
|
|
if body == player:
|
|
|
|
hide_cover(areamap['bathtop'])
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BathTop_body_exited(body):
|
|
|
|
if body == player:
|
|
|
|
show_cover(areamap['bathtop'])
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BathBot_body_entered(body):
|
|
|
|
if body == player:
|
|
|
|
hide_cover(areamap['bathbot'])
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BathBot_body_exited(body):
|
|
|
|
if body == player:
|
|
|
|
show_cover(areamap['bathbot'])
|