50 lines
1.3 KiB
GDScript
50 lines
1.3 KiB
GDScript
extends Area2D
|
|
|
|
static var rowRemoved = false
|
|
|
|
func isFull():
|
|
var amount = 0
|
|
for i in get_overlapping_areas():
|
|
if i.is_in_group("Part"):
|
|
if i.get_parent().get_parent().expand:
|
|
amount += 2
|
|
else:
|
|
amount += 1
|
|
if amount >= 10:
|
|
return true
|
|
else:
|
|
return false
|
|
|
|
func check():
|
|
if not GLOBAL.rowRemoved:
|
|
rowRemoved = false
|
|
if isFull():
|
|
GLOBAL.rowRemoved = true
|
|
var blocksSplit = []
|
|
var removeBlock = []
|
|
for i in get_overlapping_areas():
|
|
if i.is_in_group("Part"):
|
|
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():
|
|
#i.force_raycast_update()
|
|
#if i.get_collider() != null:
|
|
#blocksSplit.append(i.get_collider().get_parent().get_parent())
|
|
#if GLOBAL.currentMode == GLOBAL.MODES.TIME:
|
|
#GLOBAL.time += i.get_collider().get_parent().get_parent().type
|
|
#if i.get_collider().get_parent().get_parent().expand:
|
|
#GLOBAL.points += i.get_collider().get_parent().get_parent().type * 2
|
|
#else:
|
|
#GLOBAL.points += i.get_collider().get_parent().get_parent().type
|
|
#i.get_collider().free()
|
|
#for j in blocksSplit:
|
|
#j.splitParts()
|