2022-08-04 10:50:28 -06:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
onready var sprite = $Sprite
|
2022-08-04 18:05:48 -06:00
|
|
|
onready var door_area = $DoorArea2D
|
|
|
|
|
|
|
|
signal come_home
|
|
|
|
|
|
|
|
var id : int
|
2022-08-08 15:32:57 -06:00
|
|
|
var NeighborSprite = {
|
|
|
|
0:"aberlin",
|
|
|
|
1:"chad",
|
|
|
|
2:"gary",
|
|
|
|
3:"maggie",
|
|
|
|
4:"sarah",
|
|
|
|
5:"steve",
|
|
|
|
6:"tim",
|
|
|
|
7:"tyler"
|
|
|
|
}
|
2022-08-04 10:50:28 -06:00
|
|
|
|
|
|
|
func _ready() -> void:
|
2022-08-04 18:05:48 -06:00
|
|
|
id = int(self.name[-1])
|
2022-08-08 15:32:57 -06:00
|
|
|
sprite.texture = load("res://assets/%sHouse.png" % NeighborSprite[id % 8])
|
2022-08-04 18:05:48 -06:00
|
|
|
|
|
|
|
|
|
|
|
func _on_DoorArea2D_body_entered(body: Node) -> void:
|
|
|
|
if body is Neighbor:
|
|
|
|
if body.id == id:
|
|
|
|
emit_signal("come_home")
|