-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArea2D.gd
More file actions
47 lines (38 loc) · 1.03 KB
/
Area2D.gd
File metadata and controls
47 lines (38 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
tool
extends Area2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var world = get_node("..");
export var color:Color = ColorN("pink");
export var sprite:Texture setget set_sprite;
export var character_sprite:Texture;
export var removes:PoolStringArray;
export var firstText:String;
export var firstTexture:Texture;
var dropped = false;
var first = true;
func set_sprite(value):
sprite = value
if has_node("Sprite"):
$Sprite.texture=value
func _ready():
print("hat ready",self);
$Sprite.texture = sprite
#self.connect("body_entered",self,"_on_Area2D_body_entered")
func _on_Hat_body_entered(body):
if dropped or !(body is Player) or body.hat != null:
return
world.clearWall(removes)
world.color = color
body.sheet = character_sprite
body.hat = self
self.visible = false
self.collision_mask = 0
$PickupSound.play(0)
if (first):
first = false;
get_node("/root/colworld/SpeachOverlay").show(firstText,firstTexture);
func _on_Hat_body_exited(body):
if body is Player:
dropped = false;