Cleaned up the Code; reworked the Block Physics
This commit is contained in:
parent
ed9f671256
commit
9f6750b08a
48 changed files with 1237 additions and 1116 deletions
|
|
@ -1,22 +1,33 @@
|
|||
extends Area2D
|
||||
extends Node2D
|
||||
|
||||
#func _physics_process(delta: float) -> void:
|
||||
#if get_overlapping_areas().size() == 10:
|
||||
#for i in get_overlapping_areas():
|
||||
#GLOBAL.points += i.points
|
||||
#i.queue_free()#get_parent().get_parent().split()
|
||||
static var rowRemoved = false
|
||||
|
||||
func getRow():
|
||||
return get_overlapping_areas()
|
||||
func isFull():
|
||||
var full = true
|
||||
for i in get_children():
|
||||
i.force_raycast_update()
|
||||
#print(i.get_collider())
|
||||
if not i.is_colliding():
|
||||
full = false
|
||||
return full
|
||||
|
||||
func isCompleted():
|
||||
var amount = 0
|
||||
for i in get_overlapping_areas():
|
||||
if i.get_scale() == Vector2(2,2):
|
||||
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_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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue