This commit is contained in:
Exobyt 2024-09-20 22:46:27 +02:00
parent 5643fee9d3
commit 99d5016ac2
9 changed files with 171 additions and 149 deletions

View file

@ -1,4 +1,4 @@
extends Node2D
extends Area2D
@onready var spriteBlock = $Sprites/Block
@onready var spriteSpecialBlock = $Sprites/SpecialBlock
@ -27,15 +27,32 @@ func isOverlapping() -> bool:
func removeOverlapp():
var blocksSplit = []
for i in get_children():
if is_instance_of(i,RayCast2D):
i.force_raycast_update()
var collider = i.get_collider()
if collider != null and collider.get_parent().get_parent().id != GLOBAL.currentID:
blocksSplit.append(i.get_collider().get_parent().get_parent())
collider.free()
var removeBlock = []
for i in $Area2D.get_overlapping_areas():
if i.is_in_group("Part") and i.get_parent().get_parent().id != GLOBAL.currentID:
print(i)
var block = i.get_parent().get_parent()
blocksSplit.append(block)
i.free()
#if GLOBAL.currentMode == GLOBAL.MODES.TIME:
#GLOBAL.time += block.type
#if block.expand:
#GLOBAL.points += block.type * 2
#else:
#GLOBAL.points += block.type
for j in blocksSplit:
j.splitParts()
#for i in get_children():
#if is_instance_of(i,RayCast2D):
#i.force_raycast_update()
#var collider = i.get_collider()
#if collider != null and collider.get_parent().get_parent().id != GLOBAL.currentID:
#blocksSplit.append(i.get_collider().get_parent().get_parent())
#collider.free()
#for j in blocksSplit:
#j.splitParts()
func init(pos, look=0):
position = pos