Erster Prototyp
This commit is contained in:
parent
2da5af8954
commit
885351b624
48 changed files with 1350 additions and 0 deletions
4
scenes/Block/1x3/1x3_Collision.tscn
Normal file
4
scenes/Block/1x3/1x3_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://d31ahyg7o077g"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(-59, -5, 123, -5, 123, -59, -59, -59)
|
||||
1
scenes/Block/1x3/1x3_block.gd
Normal file
1
scenes/Block/1x3/1x3_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
58
scenes/Block/1x3/1x3_block.tscn
Normal file
58
scenes/Block/1x3/1x3_block.tscn
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://ddxt76ksj1jw"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_gs0af"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/1x3/1x3_block.gd" id="2_p067p"]
|
||||
[ext_resource type="PackedScene" uid="uid://d31ahyg7o077g" path="res://scenes/Block/1x3/1x3_Collision.tscn" id="3_dydci"]
|
||||
|
||||
[node name="1x3-Block" instance=ExtResource("1_gs0af")]
|
||||
script = ExtResource("2_p067p")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("3_dydci")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 2" index="0" instance=ExtResource("3_dydci")]
|
||||
position = Vector2(0, -64)
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("3_dydci")]
|
||||
position = Vector2(64, -64)
|
||||
rotation = 3.14159
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("3_dydci")]
|
||||
position = Vector2(64, 0)
|
||||
rotation = 4.71238
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(32, -96)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(32, -96)
|
||||
4
scenes/Block/1x4/1x4_Collision.tscn
Normal file
4
scenes/Block/1x4/1x4_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://bp15gv616ch2q"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(-123, -5, 123, -5, 123, -59, -123, -59)
|
||||
1
scenes/Block/1x4/1x4_block.gd
Normal file
1
scenes/Block/1x4/1x4_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
70
scenes/Block/1x4/1x4_block.tscn
Normal file
70
scenes/Block/1x4/1x4_block.tscn
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cgyslql51mvlm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_g3k8p"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/1x4/1x4_block.gd" id="2_1erjx"]
|
||||
[ext_resource type="PackedScene" uid="uid://bp15gv616ch2q" path="res://scenes/Block/1x4/1x4_Collision.tscn" id="3_s74sy"]
|
||||
|
||||
[node name="1x4-Block" instance=ExtResource("1_g3k8p")]
|
||||
script = ExtResource("2_1erjx")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("3_s74sy")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 2" index="0" instance=ExtResource("3_s74sy")]
|
||||
position = Vector2(0, -64)
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("3_s74sy")]
|
||||
position = Vector2(0, -64)
|
||||
rotation = 3.14159
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("3_s74sy")]
|
||||
position = Vector2(64, -64)
|
||||
rotation = -1.57079
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-96, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 1" index="3"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(32, -160)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(32, -96)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 2" index="3"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 3" index="3"]
|
||||
position = Vector2(-96, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(32, -96)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 4" index="3"]
|
||||
position = Vector2(32, -160)
|
||||
4
scenes/Block/2x2/2x2_Collision.tscn
Normal file
4
scenes/Block/2x2/2x2_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://kv3xj8qgo8bt"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(59, 59, -59, 59, -59, -59, 59, -59)
|
||||
1
scenes/Block/2x2/2x2_block.gd
Normal file
1
scenes/Block/2x2/2x2_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
64
scenes/Block/2x2/2x2_block.tscn
Normal file
64
scenes/Block/2x2/2x2_block.tscn
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dp4h8tas2iyqk"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_gmexj"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/2x2/2x2_block.gd" id="2_25xl5"]
|
||||
[ext_resource type="PackedScene" uid="uid://kv3xj8qgo8bt" path="res://scenes/Block/2x2/2x2_Collision.tscn" id="3_qnfwy"]
|
||||
|
||||
[node name="2x2-Block" instance=ExtResource("1_gmexj")]
|
||||
script = ExtResource("2_25xl5")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("3_qnfwy")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 2" index="0" instance=ExtResource("3_qnfwy")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("3_qnfwy")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("3_qnfwy")]
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 1" index="3"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 2" index="3"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 3" index="3"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 4" index="3"]
|
||||
position = Vector2(-32, 32)
|
||||
4
scenes/Block/2x3/2x3_Collision.tscn
Normal file
4
scenes/Block/2x3/2x3_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://c3akl5atqyawx"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(59, 59, 59, -123, -59, -123, -59, 59)
|
||||
1
scenes/Block/2x3/2x3_block.gd
Normal file
1
scenes/Block/2x3/2x3_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
90
scenes/Block/2x3/2x3_block.tscn
Normal file
90
scenes/Block/2x3/2x3_block.tscn
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://m0p5hh65ixef"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_7ihjd"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/2x3/2x3_block.gd" id="2_j00i1"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3akl5atqyawx" path="res://scenes/Block/2x3/2x3_Collision.tscn" id="3_hwreo"]
|
||||
|
||||
[node name="Block" instance=ExtResource("1_7ihjd")]
|
||||
script = ExtResource("2_j00i1")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("3_hwreo")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 2" index="0" instance=ExtResource("3_hwreo")]
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("3_hwreo")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("3_hwreo")]
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-32, -96)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 1" index="3"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D5" type="Marker2D" parent="Position 1" index="4"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D6" type="Marker2D" parent="Position 1" index="5"]
|
||||
position = Vector2(32, -96)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 2" index="3"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D5" type="Marker2D" parent="Position 2" index="4"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D6" type="Marker2D" parent="Position 2" index="5"]
|
||||
position = Vector2(96, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(-32, -96)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 3" index="3"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D5" type="Marker2D" parent="Position 3" index="4"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D6" type="Marker2D" parent="Position 3" index="5"]
|
||||
position = Vector2(32, -96)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 4" index="3"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D5" type="Marker2D" parent="Position 4" index="4"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D6" type="Marker2D" parent="Position 4" index="5"]
|
||||
position = Vector2(96, 32)
|
||||
4
scenes/Block/Fork/Fork_Collision.tscn
Normal file
4
scenes/Block/Fork/Fork_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://dc5jsudyiemsi"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(123, 59, 123, -59, 69, -59, 69, 5, -5, 5, -5, -59, -59, -59, -59, 5, -123, 5, -123, 59)
|
||||
1
scenes/Block/Fork/Fork_block.gd
Normal file
1
scenes/Block/Fork/Fork_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
91
scenes/Block/Fork/Fork_block.tscn
Normal file
91
scenes/Block/Fork/Fork_block.tscn
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dbvc3pr7niwjj"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_hrv0c"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/Fork/Fork_block.gd" id="2_x7do8"]
|
||||
[ext_resource type="PackedScene" uid="uid://dc5jsudyiemsi" path="res://scenes/Block/Fork/Fork_Collision.tscn" id="3_hwx0i"]
|
||||
|
||||
[node name="Block" instance=ExtResource("1_hrv0c")]
|
||||
script = ExtResource("2_x7do8")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("3_hwx0i")]
|
||||
|
||||
[node name="CollisionPolygon2D2" parent="Tests/Position 2" index="0" instance=ExtResource("3_hwx0i")]
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("3_hwx0i")]
|
||||
rotation = -3.14159
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("3_hwx0i")]
|
||||
rotation = -1.57079
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-96, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 1" index="3"]
|
||||
position = Vector2(96, 32)
|
||||
|
||||
[node name="Marker2D5" type="Marker2D" parent="Position 1" index="4"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D6" type="Marker2D" parent="Position 1" index="5"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(-32, -96)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 2" index="3"]
|
||||
position = Vector2(-32, 96)
|
||||
|
||||
[node name="Marker2D5" type="Marker2D" parent="Position 2" index="4"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D6" type="Marker2D" parent="Position 2" index="5"]
|
||||
position = Vector2(32, 96)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 3" index="3"]
|
||||
position = Vector2(-96, -32)
|
||||
|
||||
[node name="Marker2D5" type="Marker2D" parent="Position 3" index="4"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D6" type="Marker2D" parent="Position 3" index="5"]
|
||||
position = Vector2(-96, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(32, 96)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 4" index="3"]
|
||||
position = Vector2(32, -96)
|
||||
|
||||
[node name="Marker2D5" type="Marker2D" parent="Position 4" index="4"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D6" type="Marker2D" parent="Position 4" index="5"]
|
||||
position = Vector2(-32, -96)
|
||||
4
scenes/Block/L-small/L-small_Collision.tscn
Normal file
4
scenes/Block/L-small/L-small_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://sdjhhungtjpp"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(59, 59, 59, 5, -5, 5, -5, -59, -59, -59, -59, 59)
|
||||
1
scenes/Block/L-small/L-small_block.gd
Normal file
1
scenes/Block/L-small/L-small_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
55
scenes/Block/L-small/L-small_block.tscn
Normal file
55
scenes/Block/L-small/L-small_block.tscn
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://gmwso8esa8o8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_41sok"]
|
||||
[ext_resource type="PackedScene" uid="uid://sdjhhungtjpp" path="res://scenes/Block/L-small/L-small_Collision.tscn" id="2_1jxh0"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/L-small/L-small_block.gd" id="2_orqrx"]
|
||||
|
||||
[node name="Block" instance=ExtResource("1_41sok")]
|
||||
script = ExtResource("2_orqrx")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("2_1jxh0")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 2" index="0" instance=ExtResource("2_1jxh0")]
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("2_1jxh0")]
|
||||
rotation = -3.14159
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("2_1jxh0")]
|
||||
rotation = -1.57079
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(32, -32)
|
||||
4
scenes/Block/L/L_Collision.tscn
Normal file
4
scenes/Block/L/L_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://ce6kkaplvq6w4"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(59, 59, 59, 5, -5, 5, -5, -123, -59, -123, -59, 59)
|
||||
1
scenes/Block/L/L_block.gd
Normal file
1
scenes/Block/L/L_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
69
scenes/Block/L/L_block.tscn
Normal file
69
scenes/Block/L/L_block.tscn
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://d3083acqn1d3a"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_er5ve"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/L/L_block.gd" id="2_q1cd1"]
|
||||
[ext_resource type="PackedScene" uid="uid://ce6kkaplvq6w4" path="res://scenes/Block/L/L_Collision.tscn" id="3_wdblg"]
|
||||
|
||||
[node name="Block" instance=ExtResource("1_er5ve")]
|
||||
script = ExtResource("2_q1cd1")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("3_wdblg")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 2" index="0" instance=ExtResource("3_wdblg")]
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("3_wdblg")]
|
||||
position = Vector2(0, -64)
|
||||
rotation = -3.14159
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("3_wdblg")]
|
||||
position = Vector2(64, 0)
|
||||
rotation = -1.57079
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-32, -96)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 1" index="3"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 2" index="3"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(32, -96)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 3" index="3"]
|
||||
position = Vector2(-32, -96)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(96, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 4" index="3"]
|
||||
position = Vector2(96, -32)
|
||||
4
scenes/Block/Snake/Snake_Collision.tscn
Normal file
4
scenes/Block/Snake/Snake_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://m02134rcpv2p"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(128, 0, 128, -64, 0, -64, 0, 0, -64, 0, -64, 64, 64, 64, 64, 0)
|
||||
1
scenes/Block/Snake/Snake_block.gd
Normal file
1
scenes/Block/Snake/Snake_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
66
scenes/Block/Snake/Snake_block.tscn
Normal file
66
scenes/Block/Snake/Snake_block.tscn
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bnsptw7gc7mmp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_yh2qq"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/Snake/Snake_block.gd" id="2_5tnwi"]
|
||||
[ext_resource type="PackedScene" uid="uid://m02134rcpv2p" path="res://scenes/Block/Snake/Snake_Collision.tscn" id="3_447tx"]
|
||||
|
||||
[node name="Block" instance=ExtResource("1_yh2qq")]
|
||||
script = ExtResource("2_5tnwi")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("3_447tx")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 2" index="0" instance=ExtResource("3_447tx")]
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("3_447tx")]
|
||||
|
||||
[node name="CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("3_447tx")]
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 1" index="3"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 2" index="3"]
|
||||
position = Vector2(32, 96)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 3" index="3"]
|
||||
position = Vector2(96, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 4" index="3"]
|
||||
position = Vector2(32, 96)
|
||||
4
scenes/Block/T/T_Collision.tscn
Normal file
4
scenes/Block/T/T_Collision.tscn
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_scene format=3 uid="uid://y28wwij2c37i"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D"]
|
||||
polygon = PackedVector2Array(59, -5, 59, -59, -5, -59, -5, -123, -59, -123, -59, -59, -123, -59, -123, -5)
|
||||
1
scenes/Block/T/T_block.gd
Normal file
1
scenes/Block/T/T_block.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends "res://scenes/Block/block.gd"
|
||||
86
scenes/Block/T/T_block.tscn
Normal file
86
scenes/Block/T/T_block.tscn
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://blie7m1eu4ah0"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bu6grrxuhypny" path="res://scenes/Block/block.tscn" id="1_hgreb"]
|
||||
[ext_resource type="Script" path="res://scenes/Block/T/T_block.gd" id="2_uy5uy"]
|
||||
[ext_resource type="PackedScene" uid="uid://y28wwij2c37i" path="res://scenes/Block/T/T_Collision.tscn" id="3_n3dps"]
|
||||
|
||||
[node name="T-Block" instance=ExtResource("1_hgreb")]
|
||||
script = ExtResource("2_uy5uy")
|
||||
|
||||
[node name="Position 1" parent="Tests" index="0"]
|
||||
position = Vector2(-64, 0)
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="Tests_Area2D4#CollisionPolygon2D" parent="Tests/Position 1" index="0" instance=ExtResource("3_n3dps")]
|
||||
position = Vector2(0, -64)
|
||||
rotation = -1.57079
|
||||
|
||||
[node name="Position 2" parent="Tests" index="1"]
|
||||
position = Vector2(0, -64)
|
||||
rotation = -1.57079
|
||||
|
||||
[node name="Tests_Area2D3#CollisionPolygon2D" parent="Tests/Position 2" index="0" instance=ExtResource("3_n3dps")]
|
||||
position = Vector2(-64.0001, -63.9999)
|
||||
rotation = -3.14159
|
||||
|
||||
[node name="Position 3" parent="Tests" index="2"]
|
||||
position = Vector2(-64, -64)
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="Tests_Area2D2#CollisionPolygon2D" parent="Tests/Position 3" index="0" instance=ExtResource("3_n3dps")]
|
||||
position = Vector2(-64, -0.000141207)
|
||||
rotation = 1.57079
|
||||
|
||||
[node name="Position 4" parent="Tests" index="3"]
|
||||
position = Vector2(64, -64)
|
||||
rotation = -1.57079
|
||||
|
||||
[node name="Tests_Area2D#CollisionPolygon2D" parent="Tests/Position 4" index="0" instance=ExtResource("3_n3dps")]
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 1" index="0"]
|
||||
position = Vector2(-32, -96)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 1" index="1"]
|
||||
position = Vector2(-96, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 1" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 1" index="3"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 2" index="0"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 2" index="1"]
|
||||
position = Vector2(-32, -96)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 2" index="2"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 2" index="3"]
|
||||
position = Vector2(-32, 32)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 3" index="0"]
|
||||
position = Vector2(-96, -96)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 3" index="1"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 3" index="2"]
|
||||
position = Vector2(-32, -96)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 3" index="3"]
|
||||
position = Vector2(32, -96)
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Position 4" index="0"]
|
||||
position = Vector2(-32, -32)
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="Position 4" index="1"]
|
||||
position = Vector2(32, 32)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="Position 4" index="2"]
|
||||
position = Vector2(32, -32)
|
||||
|
||||
[node name="Marker2D4" type="Marker2D" parent="Position 4" index="3"]
|
||||
position = Vector2(32, -96)
|
||||
150
scenes/Block/block.gd
Normal file
150
scenes/Block/block.gd
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
extends Node2D
|
||||
|
||||
var secretPosition = Vector2()
|
||||
|
||||
@onready var blockParts = $BlockParts
|
||||
@onready var stopTimer = $stopTimer
|
||||
|
||||
var stopped = false
|
||||
|
||||
var type : GLOBAL.BLOCKTYPES = GLOBAL.BLOCKTYPES.LIGHT
|
||||
|
||||
var TestPositions : Dictionary = {
|
||||
1: $"Tests/Position 1",
|
||||
2: $"Tests/Position 2",
|
||||
3: $"Tests/Position 3",
|
||||
4: $"Tests/Position 4",
|
||||
}
|
||||
|
||||
var Positions : Dictionary = {
|
||||
1: $"Position 1",
|
||||
2: $"Position 2",
|
||||
3: $"Position 3",
|
||||
4: $"Position 4"
|
||||
}
|
||||
|
||||
var currentRotation = 1
|
||||
|
||||
var id = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
secretPosition = position
|
||||
generateBlockParts()
|
||||
self.modulate = Color.from_hsv((randi() % 12) / 12.0, 1, 1)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
position = secretPosition.snapped(Vector2(64,64))
|
||||
if not isCollidingBOTTOM() and( GLOBAL.hasSelectedSpeed or (self != GLOBAL.currentBlock)) :
|
||||
secretPosition.y += GLOBAL.currentSpeed * delta * 30
|
||||
if self == GLOBAL.currentBlock and not stopped:
|
||||
#if not isCollidingBOTTOM():
|
||||
# secretPosition.y += GLOBAL.SPEED.MAX * delta * 30
|
||||
#else:
|
||||
if stopTimer.is_stopped():
|
||||
stopTimer.start(0.7)
|
||||
#secretPosition = secretPosition.snapped(Vector2(64,64))
|
||||
|
||||
|
||||
if Input.is_action_just_pressed("rotate_left"):
|
||||
if not isNextRotationColliding(1):
|
||||
currentRotation = interpolateRotation(1)
|
||||
rotateBlock()
|
||||
elif not isNextRotationColliding(1,1):
|
||||
currentRotation = interpolateRotation(1,1)
|
||||
rotateBlock()
|
||||
elif Input.is_action_just_pressed("rotate_right"):
|
||||
if not isNextRotationColliding(2):
|
||||
currentRotation = interpolateRotation(2)
|
||||
rotateBlock()
|
||||
elif not isNextRotationColliding(2,1):
|
||||
currentRotation = interpolateRotation(2,1)
|
||||
rotateBlock()
|
||||
elif Input.is_action_just_pressed("left"):
|
||||
if not isCollidingLeft():
|
||||
secretPosition.x -= GLOBAL.GRID
|
||||
elif Input.is_action_just_pressed("right"):
|
||||
if not isCollidingRIGHT():
|
||||
secretPosition.x += GLOBAL.GRID
|
||||
|
||||
func isCollidingTOP() -> bool:
|
||||
for i in blockParts.get_children():
|
||||
if i.getCollisionTOP():
|
||||
return true
|
||||
return false
|
||||
|
||||
func isCollidingLeft() -> bool:
|
||||
for i in blockParts.get_children():
|
||||
if i.getCollisionLEFT():
|
||||
return true
|
||||
return false
|
||||
|
||||
func isCollidingRIGHT() -> bool:
|
||||
for i in blockParts.get_children():
|
||||
if i.getCollisionRIGHT():
|
||||
return true
|
||||
return false
|
||||
|
||||
func isCollidingBOTTOM() -> bool:
|
||||
for i in blockParts.get_children():
|
||||
if i.getCollisionBOTTOM():
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func generateBlockParts():
|
||||
for i in Positions[1].get_children():
|
||||
var blockPart = load("res://scenes/Block/block_part.tscn").instantiate()
|
||||
blockPart.position = i.position# + Vector2( GLOBAL.GRID / 2, GLOBAL.GRID / 2)
|
||||
blockParts.add_child(blockPart)
|
||||
|
||||
func rotateBlock():
|
||||
for i in blockParts.get_children().size():
|
||||
blockParts.get_children()[i].position = Positions[currentRotation].get_children()[i].position
|
||||
|
||||
func interpolateRotation(direction, additions=0):
|
||||
match direction:
|
||||
1:
|
||||
if currentRotation + 1 > 4:
|
||||
return 1 + additions
|
||||
elif currentRotation + (1 + additions) > 4:
|
||||
return 1
|
||||
elif currentRotation + (1 + additions) <= 4:
|
||||
return currentRotation + (1 + additions)
|
||||
|
||||
2:
|
||||
if currentRotation - 1 < 1:
|
||||
return 4 - additions
|
||||
elif currentRotation - (1 + additions) < 1:
|
||||
return 4
|
||||
elif currentRotation - (1 + additions) >= 1:
|
||||
return currentRotation - (1 + additions)
|
||||
|
||||
func isNextRotationColliding(direction, additions=0):
|
||||
var colliding = false
|
||||
match direction:
|
||||
1:
|
||||
for i in TestPositions[interpolateRotation(1, additions)].get_overlapping_areas():
|
||||
if not i.get_parent().get_parent() == TestPositions[interpolateRotation(1, additions)].get_parent().get_parent():
|
||||
colliding = true
|
||||
return colliding#TestPositions[interpolateRotation(1, additions)].has_overlapping_areas()
|
||||
2:
|
||||
for i in TestPositions[interpolateRotation(2, additions)].get_overlapping_areas():
|
||||
if not i.get_parent().get_parent() == TestPositions[interpolateRotation(2, additions)].get_parent().get_parent():
|
||||
colliding = true
|
||||
return colliding#TestPositions[interpolateRotation(2, additions)].has_overlapping_areas()
|
||||
|
||||
|
||||
func setId(newID):
|
||||
id = newID
|
||||
|
||||
func setType(newType):
|
||||
type = newType
|
||||
|
||||
func _on_stop_timer_timeout() -> void:
|
||||
if isCollidingBOTTOM():
|
||||
$Tests.queue_free()
|
||||
for i in Positions:
|
||||
Positions[i].queue_free()
|
||||
stopped = true
|
||||
40
scenes/Block/block.tscn
Normal file
40
scenes/Block/block.tscn
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bu6grrxuhypny"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/Block/block.gd" id="1_chscu"]
|
||||
|
||||
[node name="Block" type="Node2D"]
|
||||
script = ExtResource("1_chscu")
|
||||
|
||||
[node name="Tests" type="Node2D" parent="."]
|
||||
|
||||
[node name="Position 1" type="Area2D" parent="Tests"]
|
||||
collision_layer = 68
|
||||
collision_mask = 43
|
||||
|
||||
[node name="Position 2" type="Area2D" parent="Tests"]
|
||||
collision_layer = 68
|
||||
collision_mask = 43
|
||||
|
||||
[node name="Position 3" type="Area2D" parent="Tests"]
|
||||
collision_layer = 68
|
||||
collision_mask = 43
|
||||
|
||||
[node name="Position 4" type="Area2D" parent="Tests"]
|
||||
collision_layer = 68
|
||||
collision_mask = 43
|
||||
|
||||
[node name="Position 1" type="Node2D" parent="."]
|
||||
|
||||
[node name="Position 2" type="Node2D" parent="."]
|
||||
|
||||
[node name="Position 3" type="Node2D" parent="."]
|
||||
|
||||
[node name="Position 4" type="Node2D" parent="."]
|
||||
|
||||
[node name="BlockParts" type="Node2D" parent="."]
|
||||
|
||||
[node name="stopTimer" type="Timer" parent="."]
|
||||
process_callback = 0
|
||||
one_shot = true
|
||||
|
||||
[connection signal="timeout" from="stopTimer" to="." method="_on_stop_timer_timeout"]
|
||||
33
scenes/Block/block_part.gd
Normal file
33
scenes/Block/block_part.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
extends Area2D
|
||||
|
||||
var points = 1
|
||||
|
||||
@onready var rayCastTOP = $Raycasts/RayCastTOP
|
||||
@onready var rayCastRIGHT = $Raycasts/RayCastRIGHT
|
||||
@onready var rayCastBOTTOM = $Raycasts/RayCastBOTTOM
|
||||
@onready var rayCastLEFT = $Raycasts/RayCastLEFT
|
||||
|
||||
|
||||
func getCollisionTOP() -> bool:
|
||||
if rayCastTOP.get_collider() != null:
|
||||
if rayCastTOP.get_collider().get_parent() != get_parent():
|
||||
return rayCastTOP.is_colliding()
|
||||
return false
|
||||
|
||||
func getCollisionRIGHT() -> bool:
|
||||
if rayCastRIGHT.get_collider() != null:
|
||||
if rayCastRIGHT.get_collider().get_parent() != get_parent():
|
||||
return rayCastRIGHT.is_colliding()
|
||||
return false
|
||||
|
||||
func getCollisionBOTTOM() -> bool:
|
||||
if rayCastBOTTOM.get_collider() != null:
|
||||
if rayCastBOTTOM.get_collider().get_parent() != get_parent():
|
||||
return rayCastBOTTOM.is_colliding()
|
||||
return false
|
||||
|
||||
func getCollisionLEFT() -> bool:
|
||||
if rayCastLEFT.get_collider() != null:
|
||||
if rayCastLEFT.get_collider().get_parent() != get_parent():
|
||||
return rayCastLEFT.is_colliding()
|
||||
return false
|
||||
50
scenes/Block/block_part.tscn
Normal file
50
scenes/Block/block_part.tscn
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://yajhyi0j8b6a"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/Block/block_part.gd" id="1_nb58p"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tjkbt"]
|
||||
size = Vector2(64, 64)
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_puslh"]
|
||||
|
||||
[node name="BlockPart" type="Area2D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 4
|
||||
script = ExtResource("1_nb58p")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_tjkbt")
|
||||
|
||||
[node name="Raycasts" type="Node2D" parent="."]
|
||||
|
||||
[node name="RayCastTOP" type="RayCast2D" parent="Raycasts"]
|
||||
position = Vector2(0, -48)
|
||||
target_position = Vector2(0, -16)
|
||||
collision_mask = 11
|
||||
hit_from_inside = true
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="RayCastRIGHT" type="RayCast2D" parent="Raycasts"]
|
||||
position = Vector2(48, 0)
|
||||
target_position = Vector2(16, 0)
|
||||
collision_mask = 11
|
||||
hit_from_inside = true
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="RayCastBOTTOM" type="RayCast2D" parent="Raycasts"]
|
||||
position = Vector2(0, 48)
|
||||
target_position = Vector2(0, 16)
|
||||
collision_mask = 11
|
||||
hit_from_inside = true
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="RayCastLEFT" type="RayCast2D" parent="Raycasts"]
|
||||
position = Vector2(-48, 0)
|
||||
target_position = Vector2(-16, 0)
|
||||
collision_mask = 11
|
||||
hit_from_inside = true
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="MeshInstance2D" type="MeshInstance2D" parent="."]
|
||||
scale = Vector2(62, 62)
|
||||
mesh = SubResource("QuadMesh_puslh")
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
extends Node
|
||||
|
||||
var points = 0
|
||||
|
||||
enum SPEED {MIN= 5, MAX= 12}
|
||||
|
||||
var currentSpeed := SPEED.MIN
|
||||
|
||||
var hasSelectedSpeed = false
|
||||
|
||||
const GRID := 64
|
||||
|
||||
enum BLOCKTYPES {LIGHT, HEAVY}
|
||||
|
||||
const BLOCKS : Dictionary = {
|
||||
"1x3": "res://scenes/Block/1x3/1x3_block.tscn",
|
||||
"1x4": "res://scenes/Block/1x4/1x4_block.tscn",
|
||||
"2x2": "res://scenes/Block/2x2/2x2_block.tscn",
|
||||
"2x3": "res://scenes/Block/2x3/2x3_block.tscn",
|
||||
"T": "res://scenes/Block/T/T_block.tscn",
|
||||
"L": "res://scenes/Block/L/L_block.tscn",
|
||||
"L-small": "res://scenes/Block/L-small/L-small_block.tscn",
|
||||
"Snake": "res://scenes/Block/Snake/Snake_block.tscn",
|
||||
"Fork": "res://scenes/Block/Fork/Fork_block.tscn"
|
||||
}
|
||||
|
||||
var lastId = 0
|
||||
|
||||
var currentBlock = null
|
||||
|
||||
func getNewId() -> int:
|
||||
lastId += 1
|
||||
return lastId
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
||||
|
||||
if currentBlock != null:
|
||||
if currentBlock.stopped:
|
||||
hasSelectedSpeed = false
|
||||
33
scenes/Grid/SpeedScale.tscn
Normal file
33
scenes/Grid/SpeedScale.tscn
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://c03h0nwewolfx"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dbspjkdc5q1mc" path="res://assets/Slider.png" id="1_idpo1"]
|
||||
[ext_resource type="Texture2D" uid="uid://blj4h34gr3s0q" path="res://assets/SpeedScale.png" id="1_otl7y"]
|
||||
[ext_resource type="Script" path="res://scenes/Grid/speed_scale.gd" id="1_w2ui3"]
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_jnpcs"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, 0, 628, 0, 0, 0, 0, 0, -636)
|
||||
}
|
||||
point_count = 2
|
||||
|
||||
[node name="SpeedScale" type="Node2D"]
|
||||
script = ExtResource("1_w2ui3")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(12.8, 12.8)
|
||||
texture = ExtResource("1_otl7y")
|
||||
|
||||
[node name="Path2D" type="Path2D" parent="."]
|
||||
position = Vector2(0, 3.94867)
|
||||
scale = Vector2(1, 0.99359)
|
||||
curve = SubResource("Curve2D_jnpcs")
|
||||
|
||||
[node name="Slider" type="PathFollow2D" parent="Path2D"]
|
||||
position = Vector2(0, -636)
|
||||
progress = 1264.0
|
||||
rotates = false
|
||||
loop = false
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Path2D/Slider"]
|
||||
scale = Vector2(12.8, 12.8)
|
||||
texture = ExtResource("1_idpo1")
|
||||
7
scenes/Grid/border.tscn
Normal file
7
scenes/Grid/border.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene format=3 uid="uid://bm7rshwf6pjb"]
|
||||
|
||||
[node name="Border" type="Area2D"]
|
||||
collision_layer = 9
|
||||
collision_mask = 21
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
5
scenes/Grid/bottom.tscn
Normal file
5
scenes/Grid/bottom.tscn
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dvrotjxom4u6d"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bm7rshwf6pjb" path="res://scenes/Grid/border.tscn" id="1_djp4e"]
|
||||
|
||||
[node name="Bottom" instance=ExtResource("1_djp4e")]
|
||||
37
scenes/Grid/grid.gd
Normal file
37
scenes/Grid/grid.gd
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var spawnpoint = $Spawnpoint
|
||||
|
||||
var nextBlocks = []
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
fillNextBlocks()
|
||||
spawnBlock()
|
||||
|
||||
func spawnBlock() -> void:
|
||||
var block = nextBlocks[0]
|
||||
GLOBAL.currentBlock = block
|
||||
spawnpoint.add_child(block)
|
||||
nextBlocks.pop_at(0)
|
||||
if nextBlocks.size() < 2:
|
||||
fillNextBlocks()
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if GLOBAL.currentBlock != null:
|
||||
if GLOBAL.currentBlock.stopped:
|
||||
spawnBlock()
|
||||
|
||||
|
||||
func fillNextBlocks():
|
||||
var newBlocks = []
|
||||
for i in GLOBAL.BLOCKS:
|
||||
var block = load(GLOBAL.BLOCKS[i]).instantiate()
|
||||
block.setId(GLOBAL.getNewId())
|
||||
block.setType(GLOBAL.BLOCKTYPES.LIGHT)
|
||||
newBlocks.append(block)
|
||||
newBlocks.shuffle()
|
||||
newBlocks[0].setType(GLOBAL.BLOCKTYPES.HEAVY)
|
||||
newBlocks.shuffle()
|
||||
nextBlocks.append_array(newBlocks)
|
||||
118
scenes/Grid/grid.tscn
Normal file
118
scenes/Grid/grid.tscn
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://dwl4lotl1d3ij"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/Grid/grid.gd" id="1_vie5m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bm7rshwf6pjb" path="res://scenes/Grid/border.tscn" id="4_3j08q"]
|
||||
[ext_resource type="PackedScene" uid="uid://duubii5uu3lgq" path="res://scenes/Grid/row_test.tscn" id="4_si3v6"]
|
||||
[ext_resource type="PackedScene" uid="uid://dvrotjxom4u6d" path="res://scenes/Grid/bottom.tscn" id="5_14njh"]
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_qfjsc"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_flipi"]
|
||||
size = Vector2(128, 1536)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rxd0s"]
|
||||
size = Vector2(896, 64)
|
||||
|
||||
[node name="Grid" type="Node2D"]
|
||||
script = ExtResource("1_vie5m")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(7.62939e-06, 7.62939e-06)
|
||||
scale = Vector2(108.422, 96.375)
|
||||
|
||||
[node name="MeshInstance2D" type="MeshInstance2D" parent="."]
|
||||
modulate = Color(0.359096, 0.426588, 0.599397, 1)
|
||||
position = Vector2(320, 640)
|
||||
scale = Vector2(640, 1280)
|
||||
mesh = SubResource("QuadMesh_qfjsc")
|
||||
|
||||
[node name="Blocks" type="Node2D" parent="."]
|
||||
|
||||
[node name="Border" parent="." instance=ExtResource("4_3j08q")]
|
||||
|
||||
[node name="CollisionShape2D" parent="Border" index="0"]
|
||||
position = Vector2(-64, 512)
|
||||
shape = SubResource("RectangleShape2D_flipi")
|
||||
|
||||
[node name="Border2" parent="." instance=ExtResource("4_3j08q")]
|
||||
|
||||
[node name="CollisionShape2D" parent="Border2" index="0"]
|
||||
position = Vector2(704, 512)
|
||||
shape = SubResource("RectangleShape2D_flipi")
|
||||
|
||||
[node name="Bottom" parent="." instance=ExtResource("5_14njh")]
|
||||
position = Vector2(320, 1312)
|
||||
collision_layer = 8
|
||||
collision_mask = 4
|
||||
|
||||
[node name="CollisionShape2D" parent="Bottom" index="0"]
|
||||
shape = SubResource("RectangleShape2D_rxd0s")
|
||||
|
||||
[node name="Spawnpoint" type="Marker2D" parent="."]
|
||||
position = Vector2(320, -64)
|
||||
|
||||
[node name="RowTests" type="Node2D" parent="."]
|
||||
|
||||
[node name="rowTest" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 1248)
|
||||
|
||||
[node name="rowTest2" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 1184)
|
||||
|
||||
[node name="rowTest3" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 1120)
|
||||
|
||||
[node name="rowTest4" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 1056)
|
||||
|
||||
[node name="rowTest5" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 992)
|
||||
|
||||
[node name="rowTest6" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 928)
|
||||
|
||||
[node name="rowTest7" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 864)
|
||||
|
||||
[node name="rowTest8" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 800)
|
||||
|
||||
[node name="rowTest9" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 736)
|
||||
|
||||
[node name="rowTest10" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 672)
|
||||
|
||||
[node name="rowTest11" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 608)
|
||||
|
||||
[node name="rowTest12" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 544)
|
||||
|
||||
[node name="rowTest13" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 480)
|
||||
|
||||
[node name="rowTest14" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 416)
|
||||
|
||||
[node name="rowTest15" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 352)
|
||||
|
||||
[node name="rowTest16" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 288)
|
||||
|
||||
[node name="rowTest17" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 224)
|
||||
|
||||
[node name="rowTest18" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 160)
|
||||
|
||||
[node name="rowTest19" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 96)
|
||||
|
||||
[node name="rowTest20" parent="RowTests" instance=ExtResource("4_si3v6")]
|
||||
position = Vector2(0, 32)
|
||||
|
||||
[editable path="Border"]
|
||||
[editable path="Border2"]
|
||||
[editable path="Bottom"]
|
||||
7
scenes/Grid/row_test.gd
Normal file
7
scenes/Grid/row_test.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Area2D
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if get_overlapping_areas().size() == 10 and GLOBAL.currentBlock.stopped:
|
||||
for i in get_overlapping_areas():
|
||||
GLOBAL.points += i.points
|
||||
i.queue_free()#get_parent().get_parent().split()
|
||||
15
scenes/Grid/row_test.tscn
Normal file
15
scenes/Grid/row_test.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://duubii5uu3lgq"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/Grid/row_test.gd" id="1_a8m2k"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rkqoc"]
|
||||
size = Vector2(640, 20)
|
||||
|
||||
[node name="rowTest" type="Area2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_a8m2k")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(320, 0)
|
||||
shape = SubResource("RectangleShape2D_rkqoc")
|
||||
10
scenes/Grid/speed_scale.gd
Normal file
10
scenes/Grid/speed_scale.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var slider = $Path2D/Slider
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not GLOBAL.hasSelectedSpeed:
|
||||
if Input.is_action_just_pressed("stop"):
|
||||
GLOBAL.hasSelectedSpeed = true
|
||||
GLOBAL.currentSpeed = GLOBAL.SPEED.MAX
|
||||
print()
|
||||
16
scenes/Main/main.tscn
Normal file
16
scenes/Main/main.tscn
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bq5hrqgv0f6hp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dwl4lotl1d3ij" path="res://scenes/Grid/grid.tscn" id="1_88eap"]
|
||||
[ext_resource type="PackedScene" uid="uid://c03h0nwewolfx" path="res://scenes/Grid/SpeedScale.tscn" id="2_mnoeo"]
|
||||
|
||||
[node name="main" type="Node"]
|
||||
|
||||
[node name="Grid" parent="." instance=ExtResource("1_88eap")]
|
||||
position = Vector2(128, 256)
|
||||
|
||||
[node name="Node2D" parent="." instance=ExtResource("2_mnoeo")]
|
||||
visible = false
|
||||
position = Vector2(960, 896)
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position = Vector2(448, 800)
|
||||
Loading…
Add table
Add a link
Reference in a new issue