Test
This commit is contained in:
parent
5643fee9d3
commit
99d5016ac2
9 changed files with 171 additions and 149 deletions
|
|
@ -1,15 +1,19 @@
|
|||
extends Node2D
|
||||
extends Area2D
|
||||
|
||||
static var rowRemoved = false
|
||||
|
||||
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
|
||||
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:
|
||||
|
|
@ -18,16 +22,29 @@ func check():
|
|||
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())
|
||||
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 += 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
|
||||
GLOBAL.time += block.type
|
||||
if block.expand:
|
||||
GLOBAL.points += block.type * 2
|
||||
else:
|
||||
GLOBAL.points += i.get_collider().get_parent().get_parent().type
|
||||
i.get_collider().free()
|
||||
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()
|
||||
|
|
|
|||
|
|
@ -1,66 +1,16 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://ibyhtfpc52vc"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://ibyhtfpc52vc"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/Grid/row_test.gd" id="1_2nxxe"]
|
||||
|
||||
[node name="RowTest" type="Node2D"]
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_t04sr"]
|
||||
size = Vector2(624, 48)
|
||||
|
||||
[node name="RowTest" type="Area2D"]
|
||||
collision_layer = 16
|
||||
collision_mask = 8
|
||||
input_pickable = false
|
||||
script = ExtResource("1_2nxxe")
|
||||
|
||||
[node name="RayCast2D" type="RayCast2D" parent="."]
|
||||
position = Vector2(32, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D2" type="RayCast2D" parent="."]
|
||||
position = Vector2(96, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D3" type="RayCast2D" parent="."]
|
||||
position = Vector2(160, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D4" type="RayCast2D" parent="."]
|
||||
position = Vector2(224, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D5" type="RayCast2D" parent="."]
|
||||
position = Vector2(288, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D6" type="RayCast2D" parent="."]
|
||||
position = Vector2(352, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D7" type="RayCast2D" parent="."]
|
||||
position = Vector2(416, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D8" type="RayCast2D" parent="."]
|
||||
position = Vector2(480, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D9" type="RayCast2D" parent="."]
|
||||
position = Vector2(544, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="RayCast2D10" type="RayCast2D" parent="."]
|
||||
position = Vector2(608, 24)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 24
|
||||
hit_from_inside = true
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(320, 32)
|
||||
shape = SubResource("RectangleShape2D_t04sr")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue