Compare commits

...

1 commit

Author SHA1 Message Date
cb570cc0f4 WIP: sticker land detection + sticker mode 2024-08-01 00:54:42 +02:00
2 changed files with 27 additions and 8 deletions

View file

@ -24,12 +24,13 @@ class_name Sticker extends Area2D
test = null
var meta:PackedStringArray = ["sticker"]
var detected_solids:Array
var detected_stickers:Array
func _init():
collision_layer = 2
collision_mask = 0
collision_mask = 15
set_meta("tags",meta)
monitoring = false
monitoring = true
func _enter_tree():
set_meta("tags",meta)
@ -41,8 +42,24 @@ func _ready():
if (get_parent() == get_tree().root):
printerr("stickers should always have a parent")
breakpoint
body_entered.connect(_on_body_entered)
body_exited.connect(_on_body_exited)
area_entered.connect(_on_area_entered)
area_exited.connect(_on_area_exited)
func _on_body_entered(body:Node2D):
print("body entered",body)
detected_solids.append(body)
func _on_body_exited(body:Node2D):
print("body exited",body)
detected_solids.erase(body)
func _on_area_entered(area:Area2D):
print("area entered",area)
#TODO:Filter by type
detected_stickers.append(area)
func _on_area_exited(area:Area2D):
print("area exited",area)
detected_stickers.erase(area)
func _process(delta):
pass

View file

@ -122,6 +122,8 @@ mouse_right={
2d_physics/layer_1="Player"
2d_physics/layer_2="Stickers"
2d_physics/layer_3="Zone"
2d_physics/layer_4="PNJ"
[rendering]