diff --git a/Spash Screen.png b/Spash Screen.png new file mode 100644 index 0000000..bf8ff66 Binary files /dev/null and b/Spash Screen.png differ diff --git a/Spash Screen.png.import b/Spash Screen.png.import new file mode 100644 index 0000000..1c12156 --- /dev/null +++ b/Spash Screen.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dqray31t2hrpr" +path="res://.godot/imported/Spash Screen.png-ed51e1282ab008bd58c5c442fcf2b95c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Spash Screen.png" +dest_files=["res://.godot/imported/Spash Screen.png-ed51e1282ab008bd58c5c442fcf2b95c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/Spash Screen.png b/assets/Spash Screen.png new file mode 100644 index 0000000..b3ca68d Binary files /dev/null and b/assets/Spash Screen.png differ diff --git a/assets/Spash Screen.png.import b/assets/Spash Screen.png.import new file mode 100644 index 0000000..9822d01 --- /dev/null +++ b/assets/Spash Screen.png.import @@ -0,0 +1,14 @@ +[remap] + +importer="image" +type="Image" +uid="uid://dsvcsn4a3u3by" +path="res://.godot/imported/Spash Screen.png-e4bf3d868c64976d7faedf235e897dc7.image" + +[deps] + +source_file="res://assets/Spash Screen.png" +dest_files=["res://.godot/imported/Spash Screen.png-e4bf3d868c64976d7faedf235e897dc7.image"] + +[params] + diff --git a/assets/Spash Screen.svg.import b/assets/Spash Screen.svg.import new file mode 100644 index 0000000..96888d7 --- /dev/null +++ b/assets/Spash Screen.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ijlwgubxu60f" +path="res://.godot/imported/Spash Screen.svg-9e2cdb46753c22f03ad4e202afa8c8c0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Spash Screen.svg" +dest_files=["res://.godot/imported/Spash Screen.svg-9e2cdb46753c22f03ad4e202afa8c8c0.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/assets/Text.pxo b/assets/Text.pxo new file mode 100644 index 0000000..ac64cdc Binary files /dev/null and b/assets/Text.pxo differ diff --git a/assets/background_cover.png b/assets/background_cover.png new file mode 100644 index 0000000..dc965cc Binary files /dev/null and b/assets/background_cover.png differ diff --git a/assets/background_cover.png.import b/assets/background_cover.png.import new file mode 100644 index 0000000..4089e4e --- /dev/null +++ b/assets/background_cover.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://concfa0ucfh5r" +path="res://.godot/imported/background_cover.png-4f369e6ec747afd3624cb72d387cb60f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/background_cover.png" +dest_files=["res://.godot/imported/background_cover.png-4f369e6ec747afd3624cb72d387cb60f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/banner.png b/assets/banner.png new file mode 100644 index 0000000..7ba8806 Binary files /dev/null and b/assets/banner.png differ diff --git a/assets/banner.png.import b/assets/banner.png.import new file mode 100644 index 0000000..a747be5 --- /dev/null +++ b/assets/banner.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://fb88qdd1n03w" +path="res://.godot/imported/banner.png-e7286fd0372c3fd293fa9b7b04a52c04.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/banner.png" +dest_files=["res://.godot/imported/banner.png-e7286fd0372c3fd293fa9b7b04a52c04.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/banner.pxo b/assets/banner.pxo new file mode 100644 index 0000000..c35a955 Binary files /dev/null and b/assets/banner.pxo differ diff --git a/assets/cover.png b/assets/cover.png new file mode 100644 index 0000000..b28fc77 Binary files /dev/null and b/assets/cover.png differ diff --git a/assets/cover.png.import b/assets/cover.png.import new file mode 100644 index 0000000..aee3f37 --- /dev/null +++ b/assets/cover.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d3mhmo7wgidet" +path="res://.godot/imported/cover.png-a54a6cb34ab8b6028826d2209ff06e38.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/cover.png" +dest_files=["res://.godot/imported/cover.png-a54a6cb34ab8b6028826d2209ff06e38.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/cover.pxo b/assets/cover.pxo new file mode 100644 index 0000000..4dfee05 Binary files /dev/null and b/assets/cover.pxo differ diff --git a/background_cover.pxo b/background_cover.pxo new file mode 100644 index 0000000..c152629 Binary files /dev/null and b/background_cover.pxo differ diff --git a/cover.png b/cover.png new file mode 100644 index 0000000..dc965cc Binary files /dev/null and b/cover.png differ diff --git a/cover.png.import b/cover.png.import new file mode 100644 index 0000000..1720b0d --- /dev/null +++ b/cover.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b0ap7he0u85gf" +path="res://.godot/imported/cover.png-7415a2400197f69905d305dff229e3ab.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://cover.png" +dest_files=["res://.godot/imported/cover.png-7415a2400197f69905d305dff229e3ab.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..a84bf2b Binary files /dev/null and b/icon.png differ diff --git a/icon.png.import b/icon.png.import index bd87d5f..7f73e7f 100644 --- a/icon.png.import +++ b/icon.png.import @@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.cte [params] compress/mode=0 +compress/high_quality=false compress/lossy_quality=0.7 compress/hdr_compression=1 -compress/bptc_ldr=0 compress/normal_map=0 compress/channel_pack=0 mipmaps/generate=false diff --git a/project.godot b/project.godot index e6795c3..8a068f5 100644 --- a/project.godot +++ b/project.godot @@ -11,18 +11,21 @@ config_version=5 [application] config/name="Texpand" -config/description="Submission for the GMTK Game jam 2024. Tetris with special Blocks that expands" -config/version="0.1.2" +config/description="Tetris with special Blocks that expands" +config/version="2.0.1" config/tags=PackedStringArray("game_jam") run/main_scene="res://scenes/Main/main.tscn" config/features=PackedStringArray("4.3", "GL Compatibility") run/max_fps=60 +boot_splash/bg_color=Color(0.2, 0.2, 0.2, 1) +boot_splash/image="res://assets/Spash Screen.png" config/icon="res://icon.svg" +boot_splash/minimum_display_time=1 [autoload] -DebugMenu="*res://addons/debug_menu/debug_menu.tscn" GLOBAL="*res://scenes/Globals/global.gd" +DebugMenu="*res://addons/debug_menu/debug_menu.tscn" [display] @@ -41,10 +44,17 @@ version_control/autoload_on_startup=true enabled=PackedStringArray("res://addons/debug_menu/plugin.cfg") +[github_to_itch] + +config/itch_username="Exobyt" +config/itch_project_name="" + [global_group] Block="Block" ExpandBlock="" +Border="" +Part="" [input] @@ -102,11 +112,9 @@ locale/locale_filter_mode=0 2d_physics/layer_1="map" 2d_physics/layer_2="block" -2d_physics/layer_3="rowTest" -2d_physics/layer_4="TurnTest" -2d_physics/layer_5="oneBlock" -2d_physics/layer_6="expandBlock" -2d_physics/layer_7="LoseArea" +2d_physics/layer_3="border" +2d_physics/layer_4="part" +2d_physics/layer_5="partTest" [rendering] diff --git a/scenes/Blocks/Patterns/1x3/1x3_Collision.tscn b/scenes/Blocks/Patterns/1x3/1x3_Collision.tscn deleted file mode 100644 index 9910313..0000000 --- a/scenes/Blocks/Patterns/1x3/1x3_Collision.tscn +++ /dev/null @@ -1,5 +0,0 @@ -[gd_scene format=3 uid="uid://yw2cspv5rkwh"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D"] -position = Vector2(32, 32) -polygon = PackedVector2Array(48, -16, 48, -48, -112, -48, -112, -16) diff --git a/scenes/Blocks/Patterns/1x3/1x3_block_pattern.tscn b/scenes/Blocks/Patterns/1x3/1x3_block_pattern.tscn deleted file mode 100644 index a875f4e..0000000 --- a/scenes/Blocks/Patterns/1x3/1x3_block_pattern.tscn +++ /dev/null @@ -1,18 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://b6aa24lk0ush1"] - -[ext_resource type="PackedScene" uid="uid://7knb2yqvkw6i" path="res://scenes/Blocks/Patterns/block_pattern.tscn" id="1_cqyb4"] -[ext_resource type="PackedScene" uid="uid://2v7wok4hnr6c" path="res://scenes/Blocks/Patterns/position_marker.tscn" id="2_4ivv2"] -[ext_resource type="PackedScene" uid="uid://yw2cspv5rkwh" path="res://scenes/Blocks/Patterns/1x3/1x3_Collision.tscn" id="3_vkhdr"] - -[node name="BlockPattern" instance=ExtResource("1_cqyb4")] - -[node name="PositionMarker" parent="Positions" index="0" instance=ExtResource("2_4ivv2")] -position = Vector2(-64, 0) - -[node name="PositionMarker2" parent="Positions" index="1" instance=ExtResource("2_4ivv2")] -turningPoint = true - -[node name="PositionMarker3" parent="Positions" index="2" instance=ExtResource("2_4ivv2")] -position = Vector2(64, 0) - -[node name="CollisionPolygon2D" parent="CollisionTest" index="0" instance=ExtResource("3_vkhdr")] diff --git a/scenes/Blocks/Patterns/2x2/2x2_Collision.tscn b/scenes/Blocks/Patterns/2x2/2x2_Collision.tscn deleted file mode 100644 index acac5a1..0000000 --- a/scenes/Blocks/Patterns/2x2/2x2_Collision.tscn +++ /dev/null @@ -1,4 +0,0 @@ -[gd_scene format=3 uid="uid://dw1dt1jp6e06h"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D"] -polygon = PackedVector2Array(48, 48, 48, -48, -48, -48, -48, 48) diff --git a/scenes/Blocks/Patterns/2x2/2x2_block_pattern.tscn b/scenes/Blocks/Patterns/2x2/2x2_block_pattern.tscn deleted file mode 100644 index 3b4840f..0000000 --- a/scenes/Blocks/Patterns/2x2/2x2_block_pattern.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://dneih4b0e2snv"] - -[ext_resource type="PackedScene" uid="uid://7knb2yqvkw6i" path="res://scenes/Blocks/Patterns/block_pattern.tscn" id="1_sj41y"] -[ext_resource type="PackedScene" uid="uid://2v7wok4hnr6c" path="res://scenes/Blocks/Patterns/position_marker.tscn" id="2_csenr"] -[ext_resource type="PackedScene" uid="uid://dw1dt1jp6e06h" path="res://scenes/Blocks/Patterns/2x2/2x2_Collision.tscn" id="3_10q5w"] - -[node name="BlockPattern" instance=ExtResource("1_sj41y")] - -[node name="PositionMarker" parent="Positions" index="0" instance=ExtResource("2_csenr")] -turningPoint = true - -[node name="PositionMarker2" parent="Positions" index="1" instance=ExtResource("2_csenr")] -position = Vector2(0, -64) - -[node name="PositionMarker3" parent="Positions" index="2" instance=ExtResource("2_csenr")] -position = Vector2(-64, -64) - -[node name="PositionMarker4" parent="Positions" index="3" instance=ExtResource("2_csenr")] -position = Vector2(-64, 0) - -[node name="CollisionPolygon2D" parent="CollisionTest" index="0" instance=ExtResource("3_10q5w")] -position = Vector2(-32, -32) diff --git a/scenes/Blocks/Patterns/I/I_Collision.tscn b/scenes/Blocks/Patterns/I/I_Collision.tscn deleted file mode 100644 index ad51e82..0000000 --- a/scenes/Blocks/Patterns/I/I_Collision.tscn +++ /dev/null @@ -1,4 +0,0 @@ -[gd_scene format=3 uid="uid://ufbeturvvirh"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D"] -polygon = PackedVector2Array(112, -16, 112, -48, -112, -48, -112, -16) diff --git a/scenes/Blocks/Patterns/I/I_block_pattern.tscn b/scenes/Blocks/Patterns/I/I_block_pattern.tscn deleted file mode 100644 index 886a9b1..0000000 --- a/scenes/Blocks/Patterns/I/I_block_pattern.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://hlwbhtymstbv"] - -[ext_resource type="PackedScene" uid="uid://7knb2yqvkw6i" path="res://scenes/Blocks/Patterns/block_pattern.tscn" id="1_ri22b"] -[ext_resource type="PackedScene" uid="uid://2v7wok4hnr6c" path="res://scenes/Blocks/Patterns/position_marker.tscn" id="2_6qvmy"] -[ext_resource type="PackedScene" uid="uid://ufbeturvvirh" path="res://scenes/Blocks/Patterns/I/I_Collision.tscn" id="3_1ktcx"] - -[node name="BlockPattern" instance=ExtResource("1_ri22b")] - -[node name="PositionMarker" parent="Positions" index="0" instance=ExtResource("2_6qvmy")] -position = Vector2(-64, 0) - -[node name="PositionMarker2" parent="Positions" index="1" instance=ExtResource("2_6qvmy")] -turningPoint = true - -[node name="PositionMarker3" parent="Positions" index="2" instance=ExtResource("2_6qvmy")] -position = Vector2(64, 0) - -[node name="PositionMarker4" parent="Positions" index="3" instance=ExtResource("2_6qvmy")] -position = Vector2(128, 0) - -[node name="CollisionPolygon2D" parent="CollisionTest" index="0" instance=ExtResource("3_1ktcx")] -position = Vector2(32, 32) diff --git a/scenes/Blocks/Patterns/L-Reverse/L-Reverse_Collision.tscn b/scenes/Blocks/Patterns/L-Reverse/L-Reverse_Collision.tscn deleted file mode 100644 index a0955b8..0000000 --- a/scenes/Blocks/Patterns/L-Reverse/L-Reverse_Collision.tscn +++ /dev/null @@ -1,4 +0,0 @@ -[gd_scene format=3 uid="uid://w0ak23cjswln"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D"] -polygon = PackedVector2Array(48, -16, 48, -48, -80, -48, -80, -112, -112, -112, -112, -16) diff --git a/scenes/Blocks/Patterns/L-Reverse/L-Reverse_block_pattern.tscn b/scenes/Blocks/Patterns/L-Reverse/L-Reverse_block_pattern.tscn deleted file mode 100644 index ef368d2..0000000 --- a/scenes/Blocks/Patterns/L-Reverse/L-Reverse_block_pattern.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://1ubuiryqny62"] - -[ext_resource type="PackedScene" uid="uid://7knb2yqvkw6i" path="res://scenes/Blocks/Patterns/block_pattern.tscn" id="1_y8gyp"] -[ext_resource type="PackedScene" uid="uid://2v7wok4hnr6c" path="res://scenes/Blocks/Patterns/position_marker.tscn" id="2_tsq70"] -[ext_resource type="PackedScene" uid="uid://w0ak23cjswln" path="res://scenes/Blocks/Patterns/L-Reverse/L-Reverse_Collision.tscn" id="3_k23nd"] - -[node name="BlockPattern" instance=ExtResource("1_y8gyp")] - -[node name="PositionMarker" parent="Positions" index="0" instance=ExtResource("2_tsq70")] -position = Vector2(-64, 0) - -[node name="PositionMarker2" parent="Positions" index="1" instance=ExtResource("2_tsq70")] -turningPoint = true - -[node name="PositionMarker3" parent="Positions" index="2" instance=ExtResource("2_tsq70")] -position = Vector2(64, 0) - -[node name="PositionMarker4" parent="Positions" index="3" instance=ExtResource("2_tsq70")] -position = Vector2(-64, -64) - -[node name="CollisionPolygon2D" parent="CollisionTest" index="0" instance=ExtResource("3_k23nd")] -position = Vector2(32, 32) diff --git a/scenes/Blocks/Patterns/L/L_Collision.tscn b/scenes/Blocks/Patterns/L/L_Collision.tscn deleted file mode 100644 index 9f4c82b..0000000 --- a/scenes/Blocks/Patterns/L/L_Collision.tscn +++ /dev/null @@ -1,4 +0,0 @@ -[gd_scene format=3 uid="uid://663ocu3x6tjb"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D"] -polygon = PackedVector2Array(48, 48, 48, -48, 16, -48, 16, 16, -112, 16, -112, 48) diff --git a/scenes/Blocks/Patterns/L/L_block_pattern.tscn b/scenes/Blocks/Patterns/L/L_block_pattern.tscn deleted file mode 100644 index 4c1e5f9..0000000 --- a/scenes/Blocks/Patterns/L/L_block_pattern.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://d00ywshnytrdo"] - -[ext_resource type="PackedScene" uid="uid://7knb2yqvkw6i" path="res://scenes/Blocks/Patterns/block_pattern.tscn" id="1_e7pv8"] -[ext_resource type="PackedScene" uid="uid://2v7wok4hnr6c" path="res://scenes/Blocks/Patterns/position_marker.tscn" id="2_q62gn"] -[ext_resource type="PackedScene" uid="uid://663ocu3x6tjb" path="res://scenes/Blocks/Patterns/L/L_Collision.tscn" id="3_ji3us"] - -[node name="BlockPattern" instance=ExtResource("1_e7pv8")] - -[node name="PositionMarker" parent="Positions" index="0" instance=ExtResource("2_q62gn")] -position = Vector2(-64, 0) - -[node name="PositionMarker2" parent="Positions" index="1" instance=ExtResource("2_q62gn")] -turningPoint = true - -[node name="PositionMarker3" parent="Positions" index="2" instance=ExtResource("2_q62gn")] -position = Vector2(64, 0) - -[node name="PositionMarker4" parent="Positions" index="3" instance=ExtResource("2_q62gn")] -position = Vector2(64, -64) - -[node name="CollisionPolygon2D" parent="CollisionTest" index="0" instance=ExtResource("3_ji3us")] -position = Vector2(32, -32) diff --git a/scenes/Blocks/Patterns/T/T_Collision.tscn b/scenes/Blocks/Patterns/T/T_Collision.tscn deleted file mode 100644 index fa7cc0b..0000000 --- a/scenes/Blocks/Patterns/T/T_Collision.tscn +++ /dev/null @@ -1,4 +0,0 @@ -[gd_scene format=3 uid="uid://dwfkvfcrbxr43"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D"] -polygon = PackedVector2Array(-48, 48, 112, 48, 112, 16, 48, 16, 48, -48, 16, -48, 16, 16, -48, 16) diff --git a/scenes/Blocks/Patterns/T/T_block_pattern.tscn b/scenes/Blocks/Patterns/T/T_block_pattern.tscn deleted file mode 100644 index 4b981a4..0000000 --- a/scenes/Blocks/Patterns/T/T_block_pattern.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://c25mwygtprl08"] - -[ext_resource type="PackedScene" uid="uid://7knb2yqvkw6i" path="res://scenes/Blocks/Patterns/block_pattern.tscn" id="1_1p2cg"] -[ext_resource type="PackedScene" uid="uid://2v7wok4hnr6c" path="res://scenes/Blocks/Patterns/position_marker.tscn" id="2_pponh"] -[ext_resource type="PackedScene" uid="uid://dwfkvfcrbxr43" path="res://scenes/Blocks/Patterns/T/T_Collision.tscn" id="3_svqqd"] - -[node name="BlockPattern" instance=ExtResource("1_1p2cg")] - -[node name="PositionMarker" parent="Positions" index="0" instance=ExtResource("2_pponh")] -position = Vector2(-64, 0) - -[node name="PositionMarker2" parent="Positions" index="1" instance=ExtResource("2_pponh")] -turningPoint = true - -[node name="PositionMarker3" parent="Positions" index="2" instance=ExtResource("2_pponh")] -position = Vector2(64, 0) - -[node name="PositionMarker4" parent="Positions" index="3" instance=ExtResource("2_pponh")] -position = Vector2(0, -64) - -[node name="CollisionPolygon2D" parent="CollisionTest" index="0" instance=ExtResource("3_svqqd")] -position = Vector2(-24, -32) diff --git a/scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_Collision.tscn b/scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_Collision.tscn deleted file mode 100644 index 0d31ea2..0000000 --- a/scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_Collision.tscn +++ /dev/null @@ -1,5 +0,0 @@ -[gd_scene format=3 uid="uid://wv65ib41nt8v"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D"] -position = Vector2(32, -32) -polygon = PackedVector2Array(48, 48, 48, 16, -16, 16, -16, -48, -112, -48, -112, -16, -48, -16, -48, 48) diff --git a/scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_block_pattern.tscn b/scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_block_pattern.tscn deleted file mode 100644 index 8f0a555..0000000 --- a/scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_block_pattern.tscn +++ /dev/null @@ -1,21 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://bnpmnhr43ls40"] - -[ext_resource type="PackedScene" uid="uid://7knb2yqvkw6i" path="res://scenes/Blocks/Patterns/block_pattern.tscn" id="1_skje3"] -[ext_resource type="PackedScene" uid="uid://2v7wok4hnr6c" path="res://scenes/Blocks/Patterns/position_marker.tscn" id="2_prllt"] -[ext_resource type="PackedScene" uid="uid://wv65ib41nt8v" path="res://scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_Collision.tscn" id="3_xf113"] - -[node name="BlockPattern" instance=ExtResource("1_skje3")] - -[node name="PositionMarker" parent="Positions" index="0" instance=ExtResource("2_prllt")] -position = Vector2(-64, -64) - -[node name="PositionMarker2" parent="Positions" index="1" instance=ExtResource("2_prllt")] -position = Vector2(0, -64) - -[node name="PositionMarker3" parent="Positions" index="2" instance=ExtResource("2_prllt")] -turningPoint = true - -[node name="PositionMarker4" parent="Positions" index="3" instance=ExtResource("2_prllt")] -position = Vector2(64, 0) - -[node name="CollisionPolygon2D" parent="CollisionTest" index="0" instance=ExtResource("3_xf113")] diff --git a/scenes/Blocks/Patterns/Z/Z-Collision.tscn b/scenes/Blocks/Patterns/Z/Z-Collision.tscn deleted file mode 100644 index 91b637a..0000000 --- a/scenes/Blocks/Patterns/Z/Z-Collision.tscn +++ /dev/null @@ -1,4 +0,0 @@ -[gd_scene format=3 uid="uid://dkugrxq2fo1vh"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D"] -polygon = PackedVector2Array(16, 16, 16, -48, 80, -48, 80, -80, -16, -80, -16, -16, -80, -16, -80, 16) diff --git a/scenes/Blocks/Patterns/Z/Z_block_pattern.tscn b/scenes/Blocks/Patterns/Z/Z_block_pattern.tscn deleted file mode 100644 index 380031b..0000000 --- a/scenes/Blocks/Patterns/Z/Z_block_pattern.tscn +++ /dev/null @@ -1,21 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://ba70ybe7ico7f"] - -[ext_resource type="PackedScene" uid="uid://7knb2yqvkw6i" path="res://scenes/Blocks/Patterns/block_pattern.tscn" id="1_ccvbw"] -[ext_resource type="PackedScene" uid="uid://2v7wok4hnr6c" path="res://scenes/Blocks/Patterns/position_marker.tscn" id="2_y06oe"] -[ext_resource type="PackedScene" uid="uid://dkugrxq2fo1vh" path="res://scenes/Blocks/Patterns/Z/Z-Collision.tscn" id="3_0127o"] - -[node name="BlockPattern" instance=ExtResource("1_ccvbw")] - -[node name="PositionMarker" parent="Positions" index="0" instance=ExtResource("2_y06oe")] -position = Vector2(-64, 0) - -[node name="PositionMarker2" parent="Positions" index="1" instance=ExtResource("2_y06oe")] -turningPoint = true - -[node name="PositionMarker3" parent="Positions" index="2" instance=ExtResource("2_y06oe")] -position = Vector2(0, -64) - -[node name="PositionMarker4" parent="Positions" index="3" instance=ExtResource("2_y06oe")] -position = Vector2(64, -64) - -[node name="CollisionPolygon2D" parent="CollisionTest" index="0" instance=ExtResource("3_0127o")] diff --git a/scenes/Blocks/Patterns/block_pattern.gd b/scenes/Blocks/Patterns/block_pattern.gd deleted file mode 100644 index 7ad7b3f..0000000 --- a/scenes/Blocks/Patterns/block_pattern.gd +++ /dev/null @@ -1,209 +0,0 @@ -extends Node2D - -@onready var positions = $Positions -@onready var collision = $CollisionTest - -var lastDirection = null - -var type = GLOBAL.BLOCKTYPES.LIGHT -var expand = false - -func getPositions(): - return positions.get_children() - -func checkDirection(): - print("xfsdfdsfd") - var leftCollision = false - var rightCollision = false - - movePattern(GLOBAL.Direction.RIGHT) - print("0: ", await isColliding()) - if await isColliding(): - movePattern(GLOBAL.Direction.LEFT) - print("1: ", await isColliding()) - #if await isColliding(): - #movePattern(GLOBAL.Direction.RIGHT, 2) - #print("2: ", await isColliding()) - #if await isColliding(): - #movePattern(GLOBAL.Direction.LEFT, 2) - #print("3: ", await isColliding()) - #if await isColliding(): - #resetPosition() - #print("4: ", await isColliding()) - #if await isColliding(): - #rightCollision = true - #resetPosition() - #movePattern(GLOBAL.Direction.LEFT) - #if await isColliding(): - #leftCollision = true - #print(" LEFT: ", leftCollision, "\n RIGHT: ", rightCollision) - #resetPosition() - #if await getCollidingAreas() != []: - #rightCollision = true - #resetPosition() - #movePattern(GLOBAL.Direction.LEFT) - #if await getCollidingAreas() != []: - #leftCollision = true - #resetPosition() - # - #if leftCollision: - #movePattern(GLOBAL.Direction.RIGHT) - #elif rightCollision: - #movePattern(GLOBAL.Direction.LEFT) - - - #else: - - #resetPosition() - -func moveToPosition(newPosition): - resetPosition() - position = newPosition - -func turn(direction, newPosition): - reset(newPosition) - #moveToPosition(newPosition) - rotatePattern(direction) - - #if await isColliding(): - #print(1) - #movePattern(GLOBAL.Direction.RIGHT, 1) - #if await isColliding(): - #print(2) - #movePattern(GLOBAL.Direction.LEFT,2) - #if await isColliding(): - #print(3) - #movePattern(GLOBAL.Direction.RIGHT, 3) - #if await isColliding(): - #print(4) - #movePattern(GLOBAL.Direction.LEFT, 4) - - #if await isColliding(): - #print(1) - #movePattern(GLOBAL.Direction.RIGHT, 2) - #if await isColliding(): - #print(2) - #movePattern(GLOBAL.Direction.LEFT,4) - # - if await isColliding(): - movePattern(GLOBAL.Direction.RIGHT, 1) - if await isColliding(): - movePattern(GLOBAL.Direction.RIGHT, 1) - if await isColliding(): - movePattern(GLOBAL.Direction.LEFT,3) - if await isColliding(): - movePattern(GLOBAL.Direction.LEFT,1) - - #if await isColliding(): - #print(2) - #movePattern(GLOBAL.Direction.RIGHT, 1) - #if await isColliding(): - #print(3) - #movePattern(GLOBAL.Direction.LEFT,3) - #if await isColliding(): - #print(4) - #movePattern(GLOBAL.Direction.LEFT,1) - #if await isColliding(): - #print(3) - #movePattern(GLOBAL.Direction.LEFT, 1) - #movePattern(GLOBAL.Direction.RIGHT, 3) - #if await isColliding(): - #movePattern(GLOBAL.Direction.LEFT, 2) - if await isColliding(): - resetPosition() - - - -func getCollidingAreas(): - collision.force_update_transform() - #collision.monitoring = false - #collision.monitorable = false - #await get_tree().process_frame - #await get_tree().process_frame - #collision.monitoring = true - collision.monitorable = false - await get_tree().process_frame - collision.monitorable = true - collision.monitorable = false - await get_tree().process_frame - collision.monitorable = true - var collidingAreas = [] - for i in collision.get_overlapping_areas(): - if i.is_in_group("Block"): - if i.UID != GLOBAL.currentUID: - collidingAreas.append(i) - else: - collidingAreas.append(i) - return collidingAreas - -func isColliding(): - return await getCollidingAreas() != [] - -func getCollidingBorder(): - await get_tree().process_frame - await get_tree().process_frame - await get_tree().process_frame - await get_tree().process_frame - var collidingAreas = [] - for i in collision.get_overlapping_areas(): - if not i.is_in_group("Block"): - collidingAreas.append(i) - return collidingAreas - -func getCollidingBlocks(): - await get_tree().process_frame - await get_tree().process_frame - await get_tree().process_frame - var collidingAreas = [] - for i in collision.get_overlapping_areas(): - if i.is_in_group("Block"): - if i.UID != GLOBAL.currentUID: - collidingAreas.append(i) - return collidingAreas - -#func _on_collision_test_area_entered(area: Area2D) -> void: - #if lastDirection == null: - #checkLeft() - #else: - #if lastDirection == GLOBAL.Direction.LEFT: - #print(getCollidingAreas()) - #checkRight() - #if lastDirection == GLOBAL.Direction.LEFT: - #print(getCollidingAreas()) - #print(collision.get_overlapping_areas()) - #print(getCollidingAreas()) - #print(checkLeft()) - #print(checkRight()) - -func reset(newPosition): - position = newPosition - positions.position.x = 0 - collision.position.x = 0 - rotation_degrees = 0 - -func movePattern(direction, steps = 1): - match direction: - GLOBAL.Direction.LEFT: - positions.position.x -= GLOBAL.GRID * steps - collision.position.x -= GLOBAL.GRID * steps - #print("Left") - #print(positions.position) - GLOBAL.Direction.RIGHT: - positions.position.x += GLOBAL.GRID * steps - collision.position.x += GLOBAL.GRID * steps - #print("Right") - #print(positions.position) - -func resetPosition(): - #print("RESET") - positions.position.x = 0 - collision.position.x = 0 - -func rotatePattern(direction): - match direction: - GLOBAL.Direction.LEFT: - positions.rotation_degrees += 90 - collision.rotation_degrees += 90 - GLOBAL.Direction.RIGHT: - positions.rotation_degrees -= 90 - collision.rotation_degrees -= 90 diff --git a/scenes/Blocks/Patterns/block_pattern.tscn b/scenes/Blocks/Patterns/block_pattern.tscn deleted file mode 100644 index 649a5ce..0000000 --- a/scenes/Blocks/Patterns/block_pattern.tscn +++ /dev/null @@ -1,12 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://7knb2yqvkw6i"] - -[ext_resource type="Script" path="res://scenes/Blocks/Patterns/block_pattern.gd" id="1_ne3bj"] - -[node name="BlockPattern" type="Node2D"] -script = ExtResource("1_ne3bj") - -[node name="Positions" type="Node2D" parent="."] - -[node name="CollisionTest" type="Area2D" parent="."] -collision_layer = 8 -collision_mask = 3 diff --git a/scenes/Blocks/Patterns/position_marker.gd b/scenes/Blocks/Patterns/position_marker.gd deleted file mode 100644 index 0755fdb..0000000 --- a/scenes/Blocks/Patterns/position_marker.gd +++ /dev/null @@ -1,3 +0,0 @@ -extends Marker2D - -@export var turningPoint = false diff --git a/scenes/Blocks/Patterns/position_marker.tscn b/scenes/Blocks/Patterns/position_marker.tscn deleted file mode 100644 index 4009581..0000000 --- a/scenes/Blocks/Patterns/position_marker.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://2v7wok4hnr6c"] - -[ext_resource type="Script" path="res://scenes/Blocks/Patterns/position_marker.gd" id="1_775kb"] - -[node name="PositionMarker" type="Marker2D"] -script = ExtResource("1_775kb") diff --git a/scenes/Blocks/block.gd b/scenes/Blocks/block.gd deleted file mode 100644 index 3556923..0000000 --- a/scenes/Blocks/block.gd +++ /dev/null @@ -1,76 +0,0 @@ -extends Area2D - -@onready var floorRaycast = $RaycastFloor -@onready var raycastLeft = $RaycastLeft -@onready var raycastRight = $RaycastRight -@onready var raycastTop = $RaycastTop - -@onready var spriteBlock = $Block -@onready var spriteSpecialBlock = $SpecialBlock -@onready var spriteExpandBlock = $ExpandBlock -@onready var spriteSpecialExpandedBlock = $SpecialExpandedBlock - -@export var UID = 1 - -var secretPosition = Vector2() - -var turningPoint = false - -var type = GLOBAL.BLOCKTYPES.LIGHT - -var expand = false - -func _ready() -> void: - secretPosition = position - -func getCollider(direction : GLOBAL.Direction): - match direction: - GLOBAL.Direction.BOTTOM: - return floorRaycast.get_collider() - GLOBAL.Direction.LEFT: - return raycastLeft.get_collider() - GLOBAL.Direction.RIGHT: - return raycastRight.get_collider() - GLOBAL.Direction.TOP: - return raycastTop.get_collider() - -func getNeighbours(): - var neighbours = [] - for i in get_overlapping_areas(): - if i.is_in_group("Block"): - neighbours.append(i) - return neighbours - -func getNeighboursUID(uid): - var neighbours = [] - for i in get_overlapping_areas(): - if i.is_in_group("Block"): - if i.UID == uid: - neighbours.append(i) - return neighbours - -func move(x,y): - secretPosition = position - secretPosition.x += x - secretPosition.y += y - position = secretPosition.snapped(Vector2(64, 64)) - -func moveDown(): - move(0, 64) -func moveLeft(): - move(-64, 0) -func moveRight(): - move(64, 0) - -func setlook(): - match type: - GLOBAL.BLOCKTYPES.LIGHT: - if expand: - spriteExpandBlock.show() - else: - spriteBlock.show() - GLOBAL.BLOCKTYPES.HEAVY: - if expand: - spriteSpecialExpandedBlock.show() - else: - spriteSpecialBlock.show() diff --git a/scenes/Blocks/block.tscn b/scenes/Blocks/block.tscn deleted file mode 100644 index b990606..0000000 --- a/scenes/Blocks/block.tscn +++ /dev/null @@ -1,85 +0,0 @@ -[gd_scene load_steps=9 format=3 uid="uid://do8gr42oq2a0y"] - -[ext_resource type="Script" path="res://scenes/Blocks/block.gd" id="1_t1hpt"] -[ext_resource type="Texture2D" uid="uid://cbuxv7iwn0qm7" path="res://assets/Blocks/Block.png" id="2_dyhpk"] -[ext_resource type="Texture2D" uid="uid://dni2qahrw2p0k" path="res://assets/Blocks/SpecialBlock.png" id="3_do2c5"] -[ext_resource type="Texture2D" uid="uid://jmobplsqdy6o" path="res://assets/Blocks/ExpandBlock.png" id="4_c0a60"] -[ext_resource type="Texture2D" uid="uid://13wfksnp806p" path="res://assets/Blocks/SpecialExpandedBlock.png" id="5_nea42"] - -[sub_resource type="QuadMesh" id="QuadMesh_lsuac"] - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_gvev2"] -size = Vector2(80, 80) - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_ti23g"] -size = Vector2(48, 48) - -[node name="Block" type="Area2D" groups=["Block"]] -collision_layer = 2 -collision_mask = 14 -script = ExtResource("1_t1hpt") - -[node name="MeshInstance2D" type="MeshInstance2D" parent="."] -visible = false -position = Vector2(31, 31) -scale = Vector2(62, 62) -mesh = SubResource("QuadMesh_lsuac") - -[node name="RaycastFloor" type="RayCast2D" parent="."] -position = Vector2(32, 72) -target_position = Vector2(0, 8) -collision_mask = 3 -hit_from_inside = true -collide_with_areas = true - -[node name="RaycastLeft" type="RayCast2D" parent="."] -position = Vector2(-8, 32) -target_position = Vector2(-8, 0) -collision_mask = 3 -hit_from_inside = true -collide_with_areas = true - -[node name="RaycastRight" type="RayCast2D" parent="."] -position = Vector2(72, 32) -target_position = Vector2(8, 0) -collision_mask = 3 -hit_from_inside = true -collide_with_areas = true - -[node name="RaycastTop" type="RayCast2D" parent="."] -position = Vector2(32, -8) -target_position = Vector2(0, -8) -collision_mask = 3 -hit_from_inside = true -collide_with_areas = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(32, 32) -shape = SubResource("RectangleShape2D_gvev2") - -[node name="Area2D" type="Area2D" parent="." groups=["Block"]] -collision_layer = 16 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2(32, 32) -shape = SubResource("RectangleShape2D_ti23g") - -[node name="Block" type="Sprite2D" parent="."] -visible = false -position = Vector2(32, 32) -texture = ExtResource("2_dyhpk") - -[node name="SpecialBlock" type="Sprite2D" parent="."] -visible = false -position = Vector2(32, 32) -texture = ExtResource("3_do2c5") - -[node name="ExpandBlock" type="Sprite2D" parent="."] -visible = false -position = Vector2(32, 32) -texture = ExtResource("4_c0a60") - -[node name="SpecialExpandedBlock" type="Sprite2D" parent="."] -visible = false -position = Vector2(32, 32) -texture = ExtResource("5_nea42") diff --git a/scenes/Globals/global.gd b/scenes/Globals/global.gd index aba9705..1e0ef62 100644 --- a/scenes/Globals/global.gd +++ b/scenes/Globals/global.gd @@ -2,9 +2,9 @@ extends Node var points = 0 -const minSpeed = 0.5 -const maxSpeed = 0.15 -var currentSpeed := minSpeed +enum SPEED {MIN=20, MAX=80} + +var currentSpeed = SPEED.MIN var hasSelectedSpeed = false @@ -12,37 +12,54 @@ const GRID := 64 enum BLOCKTYPES {LIGHT=1, HEAVY=3} -const BLOCKSPATTERS : Dictionary = { - "Z": "res://scenes/Blocks/Patterns/Z/Z_block_pattern.tscn", - "L": "res://scenes/Blocks/Patterns/L/L_block_pattern.tscn", - "L-Reverse": "res://scenes/Blocks/Patterns/L-Reverse/L-Reverse_block_pattern.tscn", - "Z-Reverse": "res://scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_block_pattern.tscn", - "2x2": "res://scenes/Blocks/Patterns/2x2/2x2_block_pattern.tscn", - "T": "res://scenes/Blocks/Patterns/T/T_block_pattern.tscn", - #"I": "res://scenes/Blocks/Patterns/I/I_block_pattern.tscn", - "1x3": "res://scenes/Blocks/Patterns/1x3/1x3_block_pattern.tscn" +var blockStopped = false + +var testingPhase = false + +var rowRemoved = false + +const BLOCKS : Dictionary = { + #"1x1": "res://scenes/NewBlocks/1x1/1x1.tscn", + "1x3": "res://scenes/NewBlocks/1x3/1x3.tscn", + #"1x4": "res://scenes/NewBlocks/1x4/1x4.tscn", + "2x2": "res://scenes/NewBlocks/2x2/2x2.tscn", + "L": "res://scenes/NewBlocks/L/L.tscn", + "L_Reverse": "res://scenes/NewBlocks/L_Reverse/L_Reverse.tscn", + "Z": "res://scenes/NewBlocks/Z/Z.tscn", + "Z_Reverse": "res://scenes/NewBlocks/Z_Reverse/Z_Reverse.tscn", } enum Direction {BOTTOM, LEFT, RIGHT, TOP} -var lastUID = 1 +var currentUID : int = 0 -var currentUID = lastUID +var currentID : int = 0 var time = 60 var lost = false -func getNewUID() -> int: - lastUID += 1 - return lastUID +enum MODES {INFINITE, TIME} +var currentMode = MODES.INFINITE + + +func getNewUID() -> int: + currentUID += 1 + return currentUID + +func getNewID() -> int: + currentID += 1 + return currentID func resetGame(): + currentSpeed = SPEED.MIN + rowRemoved = false + blockStopped = false + testingPhase = false lost = false points = 0 - lastUID = 0 - currentUID = lastUID - time = 60 + currentUID = 0 + resetTime() lost = false func _ready() -> void: @@ -50,3 +67,24 @@ func _ready() -> void: func lose(): lost = true + +func resetTime(): + time = 0 + + +func setTimeModeTimer(): + time = 60 + +func convertIntToTime(value) -> String: + var time = str(value) + var seconds = value % 60 + var minutes = value / 60 + if seconds < 10: + seconds = "0"+ str(seconds) + return str(minutes) + ":" + str(seconds) + +func speedUp(): + if currentSpeed + 1 <= SPEED.MAX: + currentSpeed += 0.5 + else: + currentSpeed = SPEED.MAX diff --git a/scenes/Grid/SpeedScale.tscn b/scenes/Grid/SpeedScale.tscn deleted file mode 100644 index f26ccd3..0000000 --- a/scenes/Grid/SpeedScale.tscn +++ /dev/null @@ -1,33 +0,0 @@ -[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") diff --git a/scenes/Grid/border.tscn b/scenes/Grid/border.tscn index a03dabb..262c13e 100644 --- a/scenes/Grid/border.tscn +++ b/scenes/Grid/border.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://bm7rshwf6pjb"] -[node name="Border" type="Area2D"] -collision_mask = 16 +[node name="Border" type="StaticBody2D" groups=["Border"]] +collision_mask = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/scenes/Grid/camera_2d.gd b/scenes/Grid/camera_2d.gd index 657391d..e0f391c 100644 --- a/scenes/Grid/camera_2d.gd +++ b/scenes/Grid/camera_2d.gd @@ -11,4 +11,4 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: scoreLabel.text = str(GLOBAL.points) - timeLabel.text = str(GLOBAL.time) + timeLabel.text = GLOBAL.convertIntToTime(GLOBAL.time) diff --git a/scenes/Grid/grid.gd b/scenes/Grid/grid.gd index 36b0a03..2086d65 100644 --- a/scenes/Grid/grid.gd +++ b/scenes/Grid/grid.gd @@ -1,13 +1,10 @@ extends Node2D @onready var spawnpoint = $Spawnpoint -@onready var blocks = $Blocks -@onready var tickerTimer = $Ticker -@onready var patterns = $Patterns -@onready var turnTickTimer = $TurnTick -@onready var loseArea = $LoseArea +@onready var blockContainer = $Blocks @onready var gameTimer = $GameTimer +var partPath = "res://scenes/NewBlocks/part.tscn" var nextBlocks = [] @@ -19,283 +16,73 @@ var blockSpeed = 0.5 var stopped = false - -func spawnBlock() -> void: - var block = nextBlocks[0] - GLOBAL.currentBlock = block - spawnpoint.add_child(block) - nextBlocks.pop_at(0) - if nextBlocks.size() < 2: - fillNextBlocks() - -func _ready() -> void: - if GLOBAL.time <= 30: - get_tree().paused = true - tickerTimer.start(blockSpeed) - getNewPatterns() - PlacePattern() +#func _ready() -> void: + #addBlocks() + #for i in blockContainer.get_children(): + #i.init(i.global_position) func _physics_process(delta: float) -> void: + if GLOBAL.blockStopped: + GLOBAL.testingPhase = true + for i in $Rows.get_children(): + i.check() - - var blockGroups = getBlockGroupsList() - #if Input.is_action_pressed("down"): + if $Borders/RayCast2D.is_colliding(): + GLOBAL.lose() + spawnBlock() + GLOBAL.testingPhase = false + GLOBAL.blockStopped = false + $TestTimer.start(0.2) - if Input.is_action_pressed("down") and not stopped and not Input.is_action_just_released("down"): - if not tickerTimer.is_stopped(): - blockSpeed = GLOBAL.maxSpeed - else: - if not tickerTimer.is_stopped(): - blockSpeed = GLOBAL.minSpeed - if Input.is_action_just_pressed("rotate_right") and not stopped: - if blockGroups.has(GLOBAL.currentUID): - for i in blockGroups[GLOBAL.currentUID]: - if i.turningPoint: - if currentPattern != null: - if not stopped: - currentPattern.turn(GLOBAL.Direction.RIGHT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2)) - #turnBlocks() - if turnTickTimer.is_stopped(): - turnTickTimer.start(9*delta) - if Input.is_action_just_pressed("rotate_left") and not stopped: - if blockGroups.has(GLOBAL.currentUID): - for i in blockGroups[GLOBAL.currentUID]: - if i.turningPoint: - if currentPattern != null: - if not stopped: - currentPattern.turn(GLOBAL.Direction.LEFT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2)) - #turnBlocks() - if turnTickTimer.is_stopped(): - turnTickTimer.start(9*delta) +func startGame(): + fillNextBlocks() + spawnBlock() + GLOBAL.resetGame() + match GLOBAL.currentMode: + GLOBAL.MODES.INFINITE: + GLOBAL.resetTime() + GLOBAL.MODES.TIME: + GLOBAL.setTimeModeTimer() + gameTimer.start(1) - if Input.is_action_just_pressed("left"): - moveUidGroup(GLOBAL.Direction.LEFT, GLOBAL.currentUID) - if Input.is_action_just_pressed("right"): - moveUidGroup(GLOBAL.Direction.RIGHT, GLOBAL.currentUID) +func _on_game_timer_timeout() -> void: + match GLOBAL.currentMode: + GLOBAL.MODES.INFINITE: + GLOBAL.time += 1 + GLOBAL.MODES.TIME: + if GLOBAL.time - 1 < 0: + GLOBAL.lose() + else: + GLOBAL.time -= 1 + gameTimer.start(1) + +func toggleButton(): + $Camera2D/CanvasLayer/Control.toggleButton() 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.append(load(GLOBAL.BLOCKS[i]).instantiate()) + newBlocks.shuffle() - newBlocks[0].setType(GLOBAL.BLOCKTYPES.HEAVY) + newBlocks[0].expand = true + newBlocks.shuffle() + newBlocks[0].type = GLOBAL.BLOCKTYPES.HEAVY newBlocks.shuffle() nextBlocks.append_array(newBlocks) -## returns a Dictionary with the UIDs as the Key and a List of the Blocks as the content -func getBlockGroupsList(): - var blockLists : Dictionary = {} - for i in blocks.get_children(): - if not blockLists.has(i.UID): - blockLists[i.UID] = [] - blockLists[i.UID].append(i) - return blockLists +func spawnBlock(): + GLOBAL.speedUp() + var newBlock = nextBlocks[0] + nextBlocks.pop_at(0) + if nextBlocks == []: + fillNextBlocks() + blockContainer.add_child(newBlock) + newBlock.init(spawnpoint.global_position) + newBlock.setNewID() -func getBlockedDirection(direction : GLOBAL.Direction, uid : int) -> bool: - #var blockslist = getBlockGroupsList() - var isBlocked = false - #print(getBlockGroupsList()) - if getBlockGroupsList().has(uid): - for i in getBlockGroupsList()[uid]: - if i.getCollider(direction) != null: - if i.getCollider(direction).is_in_group("Block"): - if i.getCollider(direction).UID != i.UID: - isBlocked = true - else: - isBlocked = true - return isBlocked - return true - -func splitOphansUID(uid): - var compareList = {} - #print(uid) - #print(getBlockGroupsList()[uid]) - var group = [] - for i in getBlockGroupsList()[uid]: - compareList[i] = i.getNeighboursUID(uid) - #if i.getNeighboursUID(uid) == []: - # i.UID = GLOBAL.getNewUID() - #print(i.getNeighboursUID(uid)) - if i.getNeighboursUID(uid) == []: - i.UID = GLOBAL.getNewUID() - - for i in compareList: - group.insert(0, compareList[i]) - group[0].append(i) - for j in group[0]: - if compareList[i].has(j) and not group[0].has(j): - group[0].append(j) - - for i in group: - var newUID = GLOBAL.getNewUID() - for j in i: - j.UID = newUID - -func moveUidGroup(direction, uid): - if getBlockGroupsList().has(uid): - match direction: - GLOBAL.Direction.BOTTOM: - for i in getBlockGroupsList()[uid]: - if not getBlockedDirection(GLOBAL.Direction.BOTTOM, i.UID): - i.moveDown() - GLOBAL.Direction.LEFT: - for i in getBlockGroupsList()[uid]: - if not getBlockedDirection(GLOBAL.Direction.LEFT, i.UID): - i.moveLeft() - GLOBAL.Direction.RIGHT: - for i in getBlockGroupsList()[uid]: - if not getBlockedDirection(GLOBAL.Direction.RIGHT, i.UID): - i.moveRight() - -func PlacePattern(): - patternsArray.pop_at(0) - for child in patterns.get_children(): - child.queue_free() - if patternsArray.size() <= 2: - getNewPatterns() - currentPattern = patternsArray[0] - patterns.add_child(currentPattern) - var newUID = GLOBAL.getNewUID() - GLOBAL.currentUID = newUID - var newColor = Color.from_hsv((randi() % 12) / 12.0, 1, 1) - for i in patterns.get_children(): - i.reset(Vector2()) - if currentPattern != null: - for i in currentPattern.getPositions(): - var block = load("res://scenes/Blocks/block.tscn").instantiate() - block.UID = newUID - block.modulate = newColor - block.position = spawnpoint.position + i.position - block.type = currentPattern.type - block.expand = currentPattern.expand - if i.turningPoint: - block.turningPoint = true - blocks.add_child(block) - block.setlook() - - -func getNewPatterns(): - var newPatterns = [] - for i in GLOBAL.BLOCKSPATTERS: - newPatterns.append(load(GLOBAL.BLOCKSPATTERS[i]).instantiate()) - newPatterns.shuffle() - newPatterns[0].type = GLOBAL.BLOCKTYPES.HEAVY - newPatterns.shuffle() - newPatterns[0].expand = true - #for i in newPatterns: - #i.expand = true - newPatterns.shuffle() - patternsArray.append_array(newPatterns) - -func turnBlocks(): - var turningPointBlock - for g in currentPattern.getPositions().size(): - if not getBlockGroupsList()[GLOBAL.currentUID][g].turningPoint: - getBlockGroupsList()[GLOBAL.currentUID][g].global_position = currentPattern.getPositions()[g].global_position- Vector2(32,32) - else: - turningPointBlock = getBlockGroupsList()[GLOBAL.currentUID][g] - for g in currentPattern.getPositions(): - if g.turningPoint: - turningPointBlock.global_position = g.global_position- Vector2(32,32) - -func _on_turn_tick_timeout() -> void: - turnBlocks() - -func _on_ticker_timeout() -> void: - - if getBlockedDirection(GLOBAL.Direction.BOTTOM, GLOBAL.currentUID): - - stopped = true - test() - - - for i in getBlockGroupsList(): - moveUidGroup(GLOBAL.Direction.BOTTOM, i) - - if not stopped: - tickerTimer.start(blockSpeed) - stopped = false - elif stopped: - if loseArea.get_overlapping_areas() != []: - GLOBAL.lose() - tickerTimer.start(GLOBAL.minSpeed) - stopped = false - - - -func _on_game_timer_timeout() -> void: - if GLOBAL.time - 1 > 0: - GLOBAL.time -= 1 - else: - GLOBAL.lose() - gameTimer.start(1) - - -func test(): - for i in $RowTests.get_children(): - for j in getBlockGroupsList(): - if j != GLOBAL.currentUID: - moveUidGroup(GLOBAL.Direction.BOTTOM, i) - stopped = true - var previousPosition = currentPattern.position - if currentPattern.expand: - if currentPattern.get_scale() != Vector2(2,2): - - #currentPattern.position.y -= 64 - for i in getBlockGroupsList()[GLOBAL.currentUID]: - print(i.name) - if i.turningPoint: - currentPattern.set_scale(Vector2(2,2)) - currentPattern.moveToPosition(i.global_position-spawnpoint.position) - - - for j in await currentPattern.getCollidingBorder(): - if j.is_in_group("Floor"): - currentPattern.position.y -= GLOBAL.GRID - if await currentPattern.getCollidingBorder() == []: - break - if j.is_in_group("LeftBorder"): - for s in range(1,7): - currentPattern.position.x += GLOBAL.GRID - if await currentPattern.getCollidingBorder() == []: - break - elif j.is_in_group("RightBorder"): - for s in range(1,7): - currentPattern.position.x -= GLOBAL.GRID - if await currentPattern.getCollidingBorder() == []: - break - - if await currentPattern.getCollidingBorder() == []: - for i in getBlockGroupsList()[GLOBAL.currentUID].size(): - getBlockGroupsList()[GLOBAL.currentUID][i].global_position = currentPattern.getPositions()[i].global_position - Vector2(GLOBAL.GRID, GLOBAL.GRID) - getBlockGroupsList()[GLOBAL.currentUID][i].set_scale(Vector2(2,2)) - for i in await currentPattern.getCollidingBlocks(): - i.queue_free() - - testRows() - PlacePattern() - -func testRows(): - for i in $RowTests.get_children(): - if i.isCompleted(): - for j in i.getRow(): - splitOphansUID(j.UID) - if j.expand: - GLOBAL.points += j.type * 2 - GLOBAL.time += j.type - elif not j.expand: - GLOBAL.points += j.type - GLOBAL.time += j.type - j.queue_free() - for j in getBlockGroupsList(): - if j != GLOBAL.currentUID: - moveUidGroup(GLOBAL.Direction.BOTTOM, j) - -func toggleButton(): - $Camera2D/CanvasLayer/Control.toggleButton() +func _on_test_timer_timeout() -> void: + GLOBAL.rowRemoved = false diff --git a/scenes/Grid/grid.tscn b/scenes/Grid/grid.tscn index 14c9adb..b48e4b3 100644 --- a/scenes/Grid/grid.tscn +++ b/scenes/Grid/grid.tscn @@ -1,11 +1,8 @@ -[gd_scene load_steps=21 format=3 uid="uid://dwl4lotl1d3ij"] +[gd_scene load_steps=15 format=3 uid="uid://dwl4lotl1d3ij"] [ext_resource type="Script" path="res://scenes/Grid/grid.gd" id="1_vie5m"] [ext_resource type="Texture2D" uid="uid://cj6fsj1ac11a1" path="res://assets/background.png" id="2_vakrw"] [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"] -[ext_resource type="PackedScene" uid="uid://d2m5xvw4ucwfw" path="res://scenes/Grid/lose_area.tscn" id="5_u5wlg"] [ext_resource type="Script" path="res://scenes/Grid/camera_2d.gd" id="6_mbeib"] [ext_resource type="Theme" uid="uid://1nebbd65iyce" path="res://Theme/main.tres" id="7_38u5s"] [ext_resource type="Script" path="res://scenes/Main/control.gd" id="8_4bfjb"] @@ -15,28 +12,12 @@ [ext_resource type="Texture2D" uid="uid://ct4dkk00pyv6v" path="res://assets/Buttons/RotationLeft.png" id="12_qk3ju"] [ext_resource type="Texture2D" uid="uid://5gbnb7gtwww3" path="res://assets/Buttons/RotationRight.png" id="13_kls78"] [ext_resource type="Texture2D" uid="uid://cevua7g7nsrfj" path="res://assets/Buttons/DownArrow.png" id="14_i1yud"] +[ext_resource type="PackedScene" uid="uid://ibyhtfpc52vc" path="res://scenes/Grid/row_test.tscn" id="14_ogg0j"] [ext_resource type="AudioStream" uid="uid://tf3d2uu84gf1" path="res://assets/Audio/Background.wav" id="16_ng6e7"] -[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, 128) - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_m21a1"] -size = Vector2(640, 256) - [node name="Grid" type="Node2D"] script = ExtResource("1_vie5m") -[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="TextureRect" type="TextureRect" parent="."] offset_right = 640.0 offset_bottom = 1280.0 @@ -46,109 +27,9 @@ stretch_mode = 1 [node name="Blocks" type="Node2D" parent="."] [node name="Spawnpoint" type="Marker2D" parent="."] -position = Vector2(256, -128) - -[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) - -[node name="Ticker" type="Timer" parent="."] - -[node name="Patterns" type="Node2D" parent="."] -position = Vector2(256, -128) - -[node name="TurnTick" type="Timer" parent="."] -wait_time = 0.1 -one_shot = true - -[node name="Borders" type="Node2D" parent="."] - -[node name="Border" parent="Borders" groups=["LeftBorder"] instance=ExtResource("4_3j08q")] - -[node name="CollisionShape2D" parent="Borders/Border" index="0" groups=["LeftBorder"]] -position = Vector2(-64, 512) -shape = SubResource("RectangleShape2D_flipi") - -[node name="Border2" parent="Borders" groups=["RightBorder"] instance=ExtResource("4_3j08q")] - -[node name="CollisionShape2D" parent="Borders/Border2" index="0" groups=["RightBorder"]] -position = Vector2(704, 512) -shape = SubResource("RectangleShape2D_flipi") - -[node name="Bottom" parent="." groups=["Floor"] instance=ExtResource("5_14njh")] -position = Vector2(320, 1312) -collision_mask = 2 - -[node name="CollisionShape2D" parent="Bottom" index="0"] -position = Vector2(0, 32) -shape = SubResource("RectangleShape2D_rxd0s") - -[node name="LoseArea" parent="." instance=ExtResource("5_u5wlg")] - -[node name="CollisionShape2D" type="CollisionShape2D" parent="LoseArea"] -position = Vector2(320, -128) -shape = SubResource("RectangleShape2D_m21a1") +position = Vector2(288, -96) [node name="GameTimer" type="Timer" parent="."] -autostart = true [node name="Camera2D" type="Camera2D" parent="."] position = Vector2(320, 640) @@ -193,7 +74,7 @@ layout_mode = 2 [node name="Time" type="Label" parent="Camera2D/CanvasLayer/Control/VBoxContainer/HBoxContainer2"] layout_mode = 2 -text = "Time:" +text = "Time: " label_settings = ExtResource("9_i2h5u") horizontal_alignment = 1 vertical_alignment = 1 @@ -283,17 +164,87 @@ action_mode = 0 icon = ExtResource("14_i1yud") icon_alignment = 1 -[node name="Background" type="Sprite2D" parent="."] -position = Vector2(320, 640) -scale = Vector2(10, 20) - [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("16_ng6e7") -volume_db = 5.0 -autoplay = true +volume_db = 3.0 + +[node name="Borders" type="Node2D" parent="."] + +[node name="Border" parent="Borders" instance=ExtResource("4_3j08q")] + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Borders/Border"] +polygon = PackedVector2Array(0, -64, 0, 1280, 640, 1280, 640, -64, 1088, -64, 1088, 1536, -448, 1536, -448, -64) + +[node name="RayCast2D" type="RayCast2D" parent="Borders"] +position = Vector2(32, -32) +target_position = Vector2(576, 0) +collision_mask = 2 +hit_from_inside = true + +[node name="Rows" type="Node2D" parent="."] + +[node name="RowTest" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 1216) + +[node name="RowTest2" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 1152) + +[node name="RowTest3" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 1088) + +[node name="RowTest4" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 1024) + +[node name="RowTest5" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 960) + +[node name="RowTest6" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 896) + +[node name="RowTest7" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 832) + +[node name="RowTest8" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 768) + +[node name="RowTest9" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 704) + +[node name="RowTest10" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 640) + +[node name="RowTest11" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 576) + +[node name="RowTest12" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 512) + +[node name="RowTest13" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 448) + +[node name="RowTest14" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 384) + +[node name="RowTest15" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 320) + +[node name="RowTest16" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 256) + +[node name="RowTest17" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 192) + +[node name="RowTest18" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 128) + +[node name="RowTest19" parent="Rows" instance=ExtResource("14_ogg0j")] +position = Vector2(0, 64) + +[node name="RowTest20" parent="Rows" instance=ExtResource("14_ogg0j")] + +[node name="TestTimer" type="Timer" parent="."] +one_shot = true -[connection signal="timeout" from="Ticker" to="." method="_on_ticker_timeout"] -[connection signal="timeout" from="TurnTick" to="." method="_on_turn_tick_timeout"] [connection signal="timeout" from="GameTimer" to="." method="_on_game_timer_timeout"] [connection signal="pressed" from="Camera2D/CanvasLayer/Control/HBoxContainer3/left_Button" to="Camera2D/CanvasLayer/Control" method="_on_left_button_pressed"] [connection signal="pressed" from="Camera2D/CanvasLayer/Control/HBoxContainer3/right_Button" to="Camera2D/CanvasLayer/Control" method="_on_right_button_pressed"] @@ -301,7 +252,4 @@ autoplay = true [connection signal="pressed" from="Camera2D/CanvasLayer/Control/HBoxContainer4/rotate_right_Button" to="Camera2D/CanvasLayer/Control" method="_on_rotate_right_button_pressed"] [connection signal="button_down" from="Camera2D/CanvasLayer/Control/HBoxContainer5/down_Button" to="Camera2D/CanvasLayer/Control" method="_on_down_button_button_down"] [connection signal="button_up" from="Camera2D/CanvasLayer/Control/HBoxContainer5/down_Button" to="Camera2D/CanvasLayer/Control" method="_on_down_button_button_up"] - -[editable path="Borders/Border"] -[editable path="Borders/Border2"] -[editable path="Bottom"] +[connection signal="timeout" from="TestTimer" to="." method="_on_test_timer_timeout"] diff --git a/scenes/Grid/lose_area.tscn b/scenes/Grid/lose_area.tscn deleted file mode 100644 index c249bd4..0000000 --- a/scenes/Grid/lose_area.tscn +++ /dev/null @@ -1,5 +0,0 @@ -[gd_scene format=3 uid="uid://d2m5xvw4ucwfw"] - -[node name="LoseArea" type="Area2D"] -collision_layer = 64 -collision_mask = 2 diff --git a/scenes/Grid/row_test.gd b/scenes/Grid/row_test.gd index e6806ac..cd87452 100644 --- a/scenes/Grid/row_test.gd +++ b/scenes/Grid/row_test.gd @@ -1,22 +1,50 @@ extends Area2D -#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 isCompleted(): +func isFull(): var amount = 0 for i in get_overlapping_areas(): - if i.get_scale() == Vector2(2,2): - amount += 2 - else: - amount += 1 + 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() diff --git a/scenes/Grid/row_test.tscn b/scenes/Grid/row_test.tscn index 4bd7a13..aab5caa 100644 --- a/scenes/Grid/row_test.tscn +++ b/scenes/Grid/row_test.tscn @@ -1,15 +1,16 @@ -[gd_scene load_steps=3 format=3 uid="uid://duubii5uu3lgq"] +[gd_scene load_steps=3 format=3 uid="uid://ibyhtfpc52vc"] -[ext_resource type="Script" path="res://scenes/Grid/row_test.gd" id="1_a8m2k"] +[ext_resource type="Script" path="res://scenes/Grid/row_test.gd" id="1_2nxxe"] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_rkqoc"] -size = Vector2(640, 20) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_t04sr"] +size = Vector2(624, 48) -[node name="rowTest" type="Area2D"] -collision_layer = 4 -collision_mask = 2 -script = ExtResource("1_a8m2k") +[node name="RowTest" type="Area2D"] +collision_layer = 16 +collision_mask = 8 +input_pickable = false +script = ExtResource("1_2nxxe") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(320, 0) -shape = SubResource("RectangleShape2D_rkqoc") +position = Vector2(320, 32) +shape = SubResource("RectangleShape2D_t04sr") diff --git a/scenes/Grid/speed_scale.gd b/scenes/Grid/speed_scale.gd deleted file mode 100644 index 0c80ced..0000000 --- a/scenes/Grid/speed_scale.gd +++ /dev/null @@ -1,9 +0,0 @@ -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 diff --git a/scenes/Main/main.gd b/scenes/Main/main.gd index d9da935..8a4e2cf 100644 --- a/scenes/Main/main.gd +++ b/scenes/Main/main.gd @@ -20,26 +20,22 @@ func _physics_process(delta: float) -> void: fullscreen = false if scenes.get_children() != []: if GLOBAL.lost and scenes.get_child(0).name == "Grid": - scoreOverview() + loadScoreOverview() + GLOBAL.lost = false func loadGrid(): - if $scenes/ScoreOverview != null: - $scenes/ScoreOverview.queue_free() - if $scenes/StartMenu != null: - $scenes/StartMenu.queue_free() + for i in scenes.get_children(): + i.queue_free() scenes.add_child(load("res://scenes/Grid/grid.tscn").instantiate()) $scenes/Grid.toggleButton() + $scenes/Grid.startGame() -func scoreOverview(): - if $scenes/Grid != null: - $scenes/Grid.queue_free() - if $scenes/StartMenu != null: - $scenes/StartMenu.queue_free() +func loadScoreOverview(): + for i in scenes.get_children(): + i.queue_free() scenes.add_child(load("res://scenes/ScoreOverview/score_overview.tscn").instantiate()) func loadStartMenu(): - if $scenes/ScoreOverview != null: - $scenes/ScoreOverview.queue_free() - if $scenes/Grid != null: - $scenes/Grid.queue_free() + for i in scenes.get_children(): + i.queue_free() scenes.add_child(load("res://scenes/Menu/start_menu.tscn").instantiate()) diff --git a/scenes/Main/main.tscn b/scenes/Main/main.tscn index 269ea11..ab12ee8 100644 --- a/scenes/Main/main.tscn +++ b/scenes/Main/main.tscn @@ -11,10 +11,10 @@ show_behind_parent = true anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -832.0 -offset_top = -1008.0 -offset_right = 674.0 -offset_bottom = -1991.0 +offset_left = -2856.0 +offset_top = -2504.0 +offset_right = 4287.0 +offset_bottom = -3032.0 grow_horizontal = 2 grow_vertical = 2 scale = Vector2(0.996259, 9.13391) @@ -22,56 +22,86 @@ color = Color(0.000693898, 0.000693898, 0.000693898, 1) [node name="CPUParticles2D" type="CPUParticles2D" parent="ColorRect"] modulate = Color(1, 1, 1, 0.478431) -position = Vector2(1300.87, 37.6618) +position = Vector2(3195.96, 14.0137) scale = Vector2(0.501878, 0.054741) -amount = 20 +amount = 50 lifetime = 5.0 -preprocess = 5.0 +preprocess = 20.0 speed_scale = 0.5 local_coords = true texture = ExtResource("2_5ae6b") emission_shape = 3 -emission_rect_extents = Vector2(2000, 0) +emission_rect_extents = Vector2(4000, 0) spread = 0.0 tangential_accel_max = 100.0 damping_max = 100.0 scale_amount_max = 2.0 +split_scale = true +scale_curve_x = null +scale_curve_y = null color = Color(1, 0, 0, 1) [node name="CPUParticles2D2" type="CPUParticles2D" parent="ColorRect"] modulate = Color(1, 1, 1, 0.478431) -position = Vector2(1300.87, 37.6618) +position = Vector2(3195.96, 14.0137) scale = Vector2(0.501878, 0.054741) -amount = 20 +amount = 50 lifetime = 5.0 -preprocess = 5.0 +preprocess = 20.0 speed_scale = 0.5 local_coords = true texture = ExtResource("2_5ae6b") emission_shape = 3 -emission_rect_extents = Vector2(2000, 0) +emission_rect_extents = Vector2(4000, 0) spread = 0.0 tangential_accel_max = 100.0 damping_max = 100.0 scale_amount_max = 2.0 +split_scale = true +scale_curve_x = null +scale_curve_y = null color = Color(0, 0.0499997, 1, 1) [node name="CPUParticles2D3" type="CPUParticles2D" parent="ColorRect"] modulate = Color(1, 1, 1, 0.478431) -position = Vector2(1300.87, 37.6618) +position = Vector2(3195.96, 14.0137) scale = Vector2(0.501878, 0.054741) -amount = 20 +amount = 50 lifetime = 5.0 -preprocess = 5.0 +preprocess = 20.0 speed_scale = 0.5 local_coords = true texture = ExtResource("2_5ae6b") emission_shape = 3 -emission_rect_extents = Vector2(2000, 0) +emission_rect_extents = Vector2(4000, 0) spread = 0.0 tangential_accel_max = 100.0 damping_max = 100.0 scale_amount_max = 2.0 +split_scale = true +scale_curve_x = null +scale_curve_y = null color = Color(0.966667, 1, 0, 1) +[node name="CPUParticles2D4" type="CPUParticles2D" parent="ColorRect"] +modulate = Color(1, 1, 1, 0.478431) +position = Vector2(3195.96, 14.0137) +scale = Vector2(0.501878, 0.054741) +amount = 50 +lifetime = 5.0 +preprocess = 20.0 +speed_scale = 0.5 +local_coords = true +texture = ExtResource("2_5ae6b") +emission_shape = 3 +emission_rect_extents = Vector2(4000, 0) +spread = 0.0 +tangential_accel_max = 100.0 +damping_max = 100.0 +scale_amount_max = 2.0 +split_scale = true +scale_curve_x = null +scale_curve_y = null +color = Color(0.138, 0.92, 0, 1) + [node name="scenes" type="Node" parent="."] diff --git a/scenes/Menu/start_menu.gd b/scenes/Menu/start_menu.gd index 719c1de..5d75538 100644 --- a/scenes/Menu/start_menu.gd +++ b/scenes/Menu/start_menu.gd @@ -11,5 +11,10 @@ func _process(delta: float) -> void: pass -func _on_start_button_pressed() -> void: +func _on_infinite_mode_button_pressed() -> void: + GLOBAL.currentMode = GLOBAL.MODES.INFINITE + get_parent().get_parent().loadGrid() + +func _on_time_mode_button_pressed() -> void: + GLOBAL.currentMode = GLOBAL.MODES.TIME get_parent().get_parent().loadGrid() diff --git a/scenes/Menu/start_menu.tscn b/scenes/Menu/start_menu.tscn index 8c5b908..0017176 100644 --- a/scenes/Menu/start_menu.tscn +++ b/scenes/Menu/start_menu.tscn @@ -19,7 +19,7 @@ grow_vertical = 2 theme = ExtResource("1_t0oee") script = ExtResource("2_1x51p") -[node name="StartButton" type="Button" parent="."] +[node name="VBoxContainer2" type="VBoxContainer" parent="."] layout_mode = 1 anchors_preset = 7 anchor_left = 0.5 @@ -27,13 +27,19 @@ anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 offset_left = -156.0 -offset_top = -320.0 -offset_right = 4.0 -offset_bottom = -224.0 +offset_top = -448.0 +offset_right = 164.0 +offset_bottom = -256.0 grow_horizontal = 2 grow_vertical = 0 -scale = Vector2(2, 2) -text = "Start" + +[node name="InfiniteModeButton" type="Button" parent="VBoxContainer2"] +layout_mode = 2 +text = "Infinite Mode" + +[node name="TimeModeButton" type="Button" parent="VBoxContainer2"] +layout_mode = 2 +text = "Time Mode" [node name="Label" type="Label" parent="."] layout_mode = 1 @@ -111,4 +117,5 @@ alignment = 1 layout_mode = 2 texture = ExtResource("7_mn4r0") -[connection signal="pressed" from="StartButton" to="." method="_on_start_button_pressed"] +[connection signal="pressed" from="VBoxContainer2/InfiniteModeButton" to="." method="_on_infinite_mode_button_pressed"] +[connection signal="pressed" from="VBoxContainer2/TimeModeButton" to="." method="_on_time_mode_button_pressed"] diff --git a/scenes/NewBlocks/1x1/1x1.tscn b/scenes/NewBlocks/1x1/1x1.tscn new file mode 100644 index 0000000..856e4ad --- /dev/null +++ b/scenes/NewBlocks/1x1/1x1.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=2 format=3 uid="uid://bq06tih243hte"] + +[ext_resource type="PackedScene" uid="uid://cbjkurbgojqac" path="res://scenes/NewBlocks/block.tscn" id="1_wcbl2"] + +[node name="1x1" instance=ExtResource("1_wcbl2")] +modulate = Color(0.690196, 0, 1, 1) + +[node name="CollisionPolygon2D" parent="." index="0"] +position = Vector2(-8, -8) +polygon = PackedVector2Array(40, -24, 40, 40, -24, 40, -24, -24) + +[node name="Marker2D" type="Marker2D" parent="PartPoints" index="0"] + +[node name="CollisionRayContainer#RayCast2D" type="RayCast2D" parent="." index="4"] +position = Vector2(-16, -24) +target_position = Vector2(0, 48) +collision_mask = 3 +hit_from_inside = true + +[node name="CollisionRayContainer#RayCast2D2" type="RayCast2D" parent="." index="5"] +position = Vector2(16, -24) +target_position = Vector2(0, 48) +collision_mask = 3 +hit_from_inside = true diff --git a/scenes/NewBlocks/1x3/1x3.tscn b/scenes/NewBlocks/1x3/1x3.tscn new file mode 100644 index 0000000..9827559 --- /dev/null +++ b/scenes/NewBlocks/1x3/1x3.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=2 format=3 uid="uid://def2bs6whjhkc"] + +[ext_resource type="PackedScene" uid="uid://cbjkurbgojqac" path="res://scenes/NewBlocks/block.tscn" id="1_r8yrj"] + +[node name="1x3" instance=ExtResource("1_r8yrj")] +modulate = Color(1, 1, 0, 1) + +[node name="CollisionPolygon2D" parent="." index="0"] +polygon = PackedVector2Array(-95, -31, -95, 31, 95, 31, 95, -31) + +[node name="Marker2D" type="Marker2D" parent="PartPoints" index="0"] +position = Vector2(-64, 0) + +[node name="Marker2D2" type="Marker2D" parent="PartPoints" index="1"] + +[node name="Marker2D3" type="Marker2D" parent="PartPoints" index="2"] +position = Vector2(64, 0) + +[node name="RayCast2D" type="RayCast2D" parent="." index="4"] +position = Vector2(-80, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D2" type="RayCast2D" parent="." index="5"] +position = Vector2(-48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D3" type="RayCast2D" parent="." index="6"] +position = Vector2(-16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D4" type="RayCast2D" parent="." index="7"] +position = Vector2(16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D5" type="RayCast2D" parent="." index="8"] +position = Vector2(48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D6" type="RayCast2D" parent="." index="9"] +position = Vector2(80, -24) +collision_mask = 3 +hit_from_inside = true diff --git a/scenes/NewBlocks/1x4/1x4.tscn b/scenes/NewBlocks/1x4/1x4.tscn new file mode 100644 index 0000000..065777d --- /dev/null +++ b/scenes/NewBlocks/1x4/1x4.tscn @@ -0,0 +1,62 @@ +[gd_scene load_steps=2 format=3 uid="uid://bev38s1mpx8ej"] + +[ext_resource type="PackedScene" uid="uid://cbjkurbgojqac" path="res://scenes/NewBlocks/block.tscn" id="1_sbl0g"] + +[node name="1x4" instance=ExtResource("1_sbl0g")] +modulate = Color(1, 0, 0, 1) +metadata/_edit_vertical_guides_ = [-168.0] + +[node name="CollisionPolygon2D" parent="." index="0"] +position = Vector2(32, 0) +polygon = PackedVector2Array(-127, -31, -127, 31, 127, 31, 127, -31) + +[node name="Marker2D" type="Marker2D" parent="PartPoints" index="0"] +position = Vector2(-64, 0) + +[node name="Marker2D2" type="Marker2D" parent="PartPoints" index="1"] + +[node name="Marker2D3" type="Marker2D" parent="PartPoints" index="2"] +position = Vector2(64, 0) + +[node name="Marker2D4" type="Marker2D" parent="PartPoints" index="3"] +position = Vector2(128, 0) + +[node name="RayCast2D" type="RayCast2D" parent="." index="4"] +position = Vector2(-80, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D3" type="RayCast2D" parent="." index="5"] +position = Vector2(-48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D2" type="RayCast2D" parent="." index="6"] +position = Vector2(-16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D4" type="RayCast2D" parent="." index="7"] +position = Vector2(16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D5" type="RayCast2D" parent="." index="8"] +position = Vector2(48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D6" type="RayCast2D" parent="." index="9"] +position = Vector2(80, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D7" type="RayCast2D" parent="." index="10"] +position = Vector2(112, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D8" type="RayCast2D" parent="." index="11"] +position = Vector2(144, -24) +collision_mask = 3 +hit_from_inside = true diff --git a/scenes/NewBlocks/2x2/2x2.tscn b/scenes/NewBlocks/2x2/2x2.tscn new file mode 100644 index 0000000..464ad70 --- /dev/null +++ b/scenes/NewBlocks/2x2/2x2.tscn @@ -0,0 +1,62 @@ +[gd_scene load_steps=2 format=3 uid="uid://c203pse4172mc"] + +[ext_resource type="PackedScene" uid="uid://cbjkurbgojqac" path="res://scenes/NewBlocks/block.tscn" id="1_wdx08"] + +[node name="2x2" instance=ExtResource("1_wdx08")] +modulate = Color(1, 0.627451, 0, 1) +offset = true + +[node name="CollisionPolygon2D" parent="." index="0"] +polygon = PackedVector2Array(63, 63, 63, -63, -63, -63, -63, 63) + +[node name="Marker2D" type="Marker2D" parent="PartPoints" index="0"] +position = Vector2(-32, -32) + +[node name="Marker2D2" type="Marker2D" parent="PartPoints" index="1"] +position = Vector2(32, -32) + +[node name="Marker2D3" type="Marker2D" parent="PartPoints" index="2"] +position = Vector2(-32, 32) + +[node name="Marker2D4" type="Marker2D" parent="PartPoints" index="3"] +position = Vector2(32, 32) + +[node name="RayCast2D" type="RayCast2D" parent="." index="4"] +position = Vector2(-48, -56) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D2" type="RayCast2D" parent="." index="5"] +position = Vector2(-16, -56) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D3" type="RayCast2D" parent="." index="6"] +position = Vector2(16, -56) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D4" type="RayCast2D" parent="." index="7"] +position = Vector2(48, -56) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D5" type="RayCast2D" parent="." index="8"] +position = Vector2(-48, 8) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D6" type="RayCast2D" parent="." index="9"] +position = Vector2(-16, 8) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D7" type="RayCast2D" parent="." index="10"] +position = Vector2(16, 8) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D8" type="RayCast2D" parent="." index="11"] +position = Vector2(48, 8) +collision_mask = 3 +hit_from_inside = true diff --git a/scenes/NewBlocks/L/L.tscn b/scenes/NewBlocks/L/L.tscn new file mode 100644 index 0000000..9320f6c --- /dev/null +++ b/scenes/NewBlocks/L/L.tscn @@ -0,0 +1,60 @@ +[gd_scene load_steps=2 format=3 uid="uid://d2orqrqnsxuec"] + +[ext_resource type="PackedScene" uid="uid://cbjkurbgojqac" path="res://scenes/NewBlocks/block.tscn" id="1_5vf0h"] + +[node name="L" instance=ExtResource("1_5vf0h")] +modulate = Color(0, 0, 1, 1) + +[node name="CollisionPolygon2D" parent="." index="0"] +polygon = PackedVector2Array(-95, -31, -95, 31, 95, 31, 95, -95, 33, -95, 33, -31) + +[node name="Marker2D" type="Marker2D" parent="PartPoints" index="0"] +position = Vector2(-64, 0) + +[node name="Marker2D2" type="Marker2D" parent="PartPoints" index="1"] + +[node name="Marker2D3" type="Marker2D" parent="PartPoints" index="2"] +position = Vector2(64, 0) + +[node name="Marker2D4" type="Marker2D" parent="PartPoints" index="3"] +position = Vector2(64, -64) + +[node name="RayCast2D" type="RayCast2D" parent="." index="6"] +position = Vector2(-80, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D2" type="RayCast2D" parent="." index="7"] +position = Vector2(-48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D3" type="RayCast2D" parent="." index="8"] +position = Vector2(-16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D4" type="RayCast2D" parent="." index="9"] +position = Vector2(16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D5" type="RayCast2D" parent="." index="10"] +position = Vector2(48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D6" type="RayCast2D" parent="." index="11"] +position = Vector2(80, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D7" type="RayCast2D" parent="." index="12"] +position = Vector2(48, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D8" type="RayCast2D" parent="." index="13"] +position = Vector2(80, -88) +collision_mask = 3 +hit_from_inside = true diff --git a/scenes/NewBlocks/L_Reverse/L_Reverse.tscn b/scenes/NewBlocks/L_Reverse/L_Reverse.tscn new file mode 100644 index 0000000..d98d186 --- /dev/null +++ b/scenes/NewBlocks/L_Reverse/L_Reverse.tscn @@ -0,0 +1,60 @@ +[gd_scene load_steps=2 format=3 uid="uid://rcxcslbfovej"] + +[ext_resource type="PackedScene" uid="uid://cbjkurbgojqac" path="res://scenes/NewBlocks/block.tscn" id="1_05evo"] + +[node name="L_Reverse" instance=ExtResource("1_05evo")] +modulate = Color(0, 1, 0, 1) + +[node name="CollisionPolygon2D" parent="." index="0"] +polygon = PackedVector2Array(-95, -95, -95, 31, 95, 31, 95, -31, -33, -31, -33, -95) + +[node name="Marker2D" type="Marker2D" parent="PartPoints" index="0"] +position = Vector2(-64, -64) + +[node name="Marker2D2" type="Marker2D" parent="PartPoints" index="1"] +position = Vector2(-64, 0) + +[node name="Marker2D3" type="Marker2D" parent="PartPoints" index="2"] + +[node name="Marker2D4" type="Marker2D" parent="PartPoints" index="3"] +position = Vector2(64, 0) + +[node name="RayCast2D" type="RayCast2D" parent="." index="6"] +position = Vector2(-80, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D2" type="RayCast2D" parent="." index="7"] +position = Vector2(-48, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D3" type="RayCast2D" parent="." index="8"] +position = Vector2(-80, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D4" type="RayCast2D" parent="." index="9"] +position = Vector2(-48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D5" type="RayCast2D" parent="." index="10"] +position = Vector2(-16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D6" type="RayCast2D" parent="." index="11"] +position = Vector2(16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D7" type="RayCast2D" parent="." index="12"] +position = Vector2(48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D8" type="RayCast2D" parent="." index="13"] +position = Vector2(80, -24) +collision_mask = 3 +hit_from_inside = true diff --git a/scenes/NewBlocks/Z/Z.tscn b/scenes/NewBlocks/Z/Z.tscn new file mode 100644 index 0000000..a368e24 --- /dev/null +++ b/scenes/NewBlocks/Z/Z.tscn @@ -0,0 +1,60 @@ +[gd_scene load_steps=2 format=3 uid="uid://xpcbf85u5d65"] + +[ext_resource type="PackedScene" uid="uid://cbjkurbgojqac" path="res://scenes/NewBlocks/block.tscn" id="1_yvspj"] + +[node name="Z" instance=ExtResource("1_yvspj")] +modulate = Color(1, 0, 1, 1) + +[node name="CollisionPolygon2D" parent="." index="0"] +polygon = PackedVector2Array(-95, 31, 31, 31, 31, -33, 95, -33, 95, -95, -31, -95, -31, -31, -95, -31) + +[node name="Marker2D" type="Marker2D" parent="PartPoints" index="0"] +position = Vector2(-64, 0) + +[node name="Marker2D2" type="Marker2D" parent="PartPoints" index="1"] + +[node name="Marker2D3" type="Marker2D" parent="PartPoints" index="2"] +position = Vector2(0, -64) + +[node name="Marker2D4" type="Marker2D" parent="PartPoints" index="3"] +position = Vector2(64, -64) + +[node name="RayCast2D" type="RayCast2D" parent="." index="6"] +position = Vector2(-80, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D2" type="RayCast2D" parent="." index="7"] +position = Vector2(-48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D3" type="RayCast2D" parent="." index="8"] +position = Vector2(-16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D4" type="RayCast2D" parent="." index="9"] +position = Vector2(16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D5" type="RayCast2D" parent="." index="10"] +position = Vector2(-16, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D6" type="RayCast2D" parent="." index="11"] +position = Vector2(16, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D7" type="RayCast2D" parent="." index="12"] +position = Vector2(48, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D8" type="RayCast2D" parent="." index="13"] +position = Vector2(80, -88) +collision_mask = 3 +hit_from_inside = true diff --git a/scenes/NewBlocks/Z_Reverse/Z_Reverse.tscn b/scenes/NewBlocks/Z_Reverse/Z_Reverse.tscn new file mode 100644 index 0000000..a03cc99 --- /dev/null +++ b/scenes/NewBlocks/Z_Reverse/Z_Reverse.tscn @@ -0,0 +1,60 @@ +[gd_scene load_steps=2 format=3 uid="uid://bbf3thu7apoov"] + +[ext_resource type="PackedScene" uid="uid://cbjkurbgojqac" path="res://scenes/NewBlocks/block.tscn" id="1_bjj8c"] + +[node name="Z_Reverse" instance=ExtResource("1_bjj8c")] +modulate = Color(0, 1, 1, 1) + +[node name="CollisionPolygon2D" parent="." index="0"] +polygon = PackedVector2Array(-95, -95, -95, -33, -31, -33, -31, 31, 95, 31, 95, -31, 31, -31, 31, -95) + +[node name="Marker2D" type="Marker2D" parent="PartPoints" index="0"] +position = Vector2(-64, -64) + +[node name="Marker2D2" type="Marker2D" parent="PartPoints" index="1"] +position = Vector2(0, -64) + +[node name="Marker2D3" type="Marker2D" parent="PartPoints" index="2"] + +[node name="Marker2D4" type="Marker2D" parent="PartPoints" index="3"] +position = Vector2(64, 0) + +[node name="RayCast2D" type="RayCast2D" parent="." index="6"] +position = Vector2(-80, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D2" type="RayCast2D" parent="." index="7"] +position = Vector2(-48, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D3" type="RayCast2D" parent="." index="8"] +position = Vector2(-16, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D4" type="RayCast2D" parent="." index="9"] +position = Vector2(16, -88) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D5" type="RayCast2D" parent="." index="10"] +position = Vector2(-16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D6" type="RayCast2D" parent="." index="11"] +position = Vector2(16, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D7" type="RayCast2D" parent="." index="12"] +position = Vector2(48, -24) +collision_mask = 3 +hit_from_inside = true + +[node name="RayCast2D8" type="RayCast2D" parent="." index="13"] +position = Vector2(80, -24) +collision_mask = 3 +hit_from_inside = true diff --git a/scenes/NewBlocks/block.gd b/scenes/NewBlocks/block.gd new file mode 100644 index 0000000..e0084d0 --- /dev/null +++ b/scenes/NewBlocks/block.gd @@ -0,0 +1,287 @@ +extends CharacterBody2D + +@onready var partPoints = $PartPoints +@onready var partsContainer = $PartsContainer +@onready var coyoteTimer = $CoyoteTimer + + +var part = "res://scenes/NewBlocks/part.tscn" +var block1x1 = "res://scenes/NewBlocks/1x1/1x1.tscn" + + +var coyoteTime = 0.5 + +var type = GLOBAL.BLOCKTYPES.LIGHT +var expand = false + +@export var id = 0 + +var expanding = false + +var stopped = false + +@export var offset = false + +func _physics_process(delta: float) -> void: + if isCurrent() and not GLOBAL.blockStopped and not stopped: + if isBottomColliding(): + if coyoteTimer.is_stopped(): + coyoteTimer.start(coyoteTime) + if Input.is_action_just_pressed("rotate_left"): + rotateBlock(1) + elif Input.is_action_just_pressed("rotate_right"): + rotateBlock(2) + if Input.is_action_just_pressed("left"): + + if not isLeftColliding(): + global_position.x -= GLOBAL.GRID + elif Input.is_action_just_pressed("right"): + if not isRightColliding(): + global_position.x += GLOBAL.GRID + + else: + if stopped and not isBottomColliding(): + position.y += GLOBAL.GRID + snapPosition() + if Input.is_action_pressed("down") and isCurrent(): + velocity = get_gravity() * delta * GLOBAL.SPEED.MAX + else: + velocity = get_gravity() * delta * GLOBAL.currentSpeed + #if isBottomColliding(): + #print(global_position) + #print(global_position.snapped(Vector2(64,64))) + #print(global_position.snapped(Vector2(64,64)) - Vector2(32,32)) + #print(int((global_position.snapped(Vector2(64,64)) - Vector2(32,32)).y)) + #print(int((global_position.snapped(Vector2(64,64)) - Vector2(32,32)).x)) + #print(int(global_position.x-32) % GLOBAL.GRID) + #print(int(global_position.y-32) % GLOBAL.GRID) + #print(name + ": " + str(not isBottomColliding() and not isCurrent())) + #print(global_position) + #print(int(global_position.x-32) % GLOBAL.GRID) + #print(int(global_position.y-32) % GLOBAL.GRID) + #if isBottomColliding(): + # + #if not int(global_position.x-32) % GLOBAL.GRID == 0: + #global_position.x = global_position.snapped(Vector2(64,64)).x -32 + #if not int(global_position.y-32) % GLOBAL.GRID == 0: + #global_position.y = global_position.snapped(Vector2(64,64)).y -32 + #global_position = global_position.snapped(Vector2(64,64)) + + #position.y += GLOBAL.GRID + + #if is_on_floor(): + #position = position.snapped(Vector2(32,32)) + + #if not is_on_floor() and not isCurrent() and not isBottomColliding(): + #position += Vector2(0,64) + #print(not isBottomColliding()) + #if stopped and not isBottomColliding(): + #position += Vector2(0,64) + if isCurrent() and not expanding and not GLOBAL.blockStopped: + move_and_slide() + else: + + velocity = Vector2.ZERO + +func expandBlocks(): + expanding = true + scale = Vector2(2,2) + position -= Vector2(32,32) + snapPosition() + for i in range(0,5): + if isCollidingBorder(): + if isCollidingBorder(): + position.x += GLOBAL.GRID + if isCollidingBorder(): + position.x += GLOBAL.GRID + if isCollidingBorder(): + position.x -= GLOBAL.GRID + if isCollidingBorder(): + position.x -= GLOBAL.GRID + if isCollidingBorder(): + position.x -= GLOBAL.GRID + if isCollidingBorder(): + position.x -= GLOBAL.GRID + if isCollidingBorder(): + position.x += GLOBAL.GRID + if isCollidingBorder(): + position.x += GLOBAL.GRID + if isCollidingBorder(): + position.y -= GLOBAL.GRID + + for i in partsContainer.get_children(): + #print(i) + i.removeOverlapp() + #splitParts() + +func addParts(): + for i in partPoints.get_children(): + var newPart = load(part).instantiate() + partsContainer.add_child(newPart) + var look = 0 + if not expand and type == GLOBAL.BLOCKTYPES.HEAVY: + look = 1 + elif expand and not type == GLOBAL.BLOCKTYPES.HEAVY: + look = 2 + elif expand and type == GLOBAL.BLOCKTYPES.HEAVY: + look = 3 + newPart.init(i.position,look) + + + +func setColor(color): + modulate = color + + +func setNewID(): + id = GLOBAL.getNewID() + +func isCurrent(): + return GLOBAL.currentID == id + +func snapPosition(): #x :bool, y: bool + if not offset and not expand: + global_position = global_position.snapped(Vector2(64,64)) - Vector2(32,32) + else: + global_position = global_position.snapped(Vector2(64,64)) + #position = position.snapped(Vector2(64,64)) + +func rotateBlock(direction): + match direction: + 1: + rotation_degrees -= 90 + for i in partsContainer.get_children(): + i.rotation_degrees += 90 + for j in range(0,3): + if isColliding(): + global_position.x -= GLOBAL.GRID + if isColliding(): + global_position.x += GLOBAL.GRID*2 + if isColliding(): + global_position.x -= GLOBAL.GRID + for s in range(0,3): + rotation_degrees -= 90 + for i in partsContainer.get_children(): + i.rotation_degrees += 90 + else: + break + else: + break + else: + break + 2: + rotation_degrees += 90 + for i in partsContainer.get_children(): + i.rotation_degrees -= 90 + for j in range(0,3): + if isColliding(): + global_position.x -= GLOBAL.GRID + if isColliding(): + global_position.x += GLOBAL.GRID*2 + if isColliding(): + global_position.x -= GLOBAL.GRID + for s in range(0,3): + rotation_degrees += 90 + for i in partsContainer.get_children(): + i.rotation_degrees -= 90 + else: + break + else: + break + else: + break + +func isLeftColliding(): + var colliding = false + for i in partsContainer.get_children(): + if i.isLeftColliding(): + colliding = true + return colliding + +func isRightColliding(): + var colliding = false + for i in partsContainer.get_children(): + if i.isRightColliding(): + colliding = true + return colliding + +func isBottomColliding(): + var colliding = false + for i in partsContainer.get_children(): + if i.isBottomColliding(): + colliding = true + return colliding + +func isColliding() -> bool: + var collided = false + for i in get_children(): + if is_instance_of(i,RayCast2D): + i.force_raycast_update() + var collider = i.get_collider() + if collider != null: + if collider.is_in_group("Block"): + if collider.id != GLOBAL.currentID: + collided = true + elif collider.is_in_group("Border"): + collided = true + return collided + + +func isCollidingBorder() -> bool: + var collided = false + for i in get_children(): + if is_instance_of(i,RayCast2D): + i.force_raycast_update() + var collider = i.get_collider() + if collider != null: + if collider.is_in_group("Border"): + collided = true + return collided + +func _on_animation_player_animation_finished(anim_name: StringName) -> void: + if anim_name == "Expand": + snapPosition() + #position -= Vector2(32,32) + splitParts() + + +func _on_coyote_timer_timeout() -> void: + if isBottomColliding(): + snapPosition() + stopped = true + GLOBAL.blockStopped = true + if expand: + expandBlocks() + +func init(pos): + if expand and stopped: + #$AnimationPlayer.play("Expand") + scale = Vector2(2,2) + addParts() + id = GLOBAL.getNewID() + GLOBAL.currentID = id + snapPosition() + global_position = pos + if offset: + snapPosition() + + +func splitParts(): + for i in $PartsContainer.get_children(): + var newBlock = load(block1x1).instantiate() + get_parent().add_child(newBlock) + newBlock.clone(expand, type, stopped) + newBlock.init(i.global_position) + newBlock.setColor(modulate) + queue_free() + +func clone(newExpand=false, newType=GLOBAL.BLOCKTYPES.LIGHT, newStopped=false): + expand = newExpand + stopped = newStopped + type = newType + #if not expand and type == GLOBAL.BLOCKTYPES.HEAVY: + #look = 1 + #elif expand and not type == GLOBAL.BLOCKTYPES.HEAVY: + #look = 2 + #elif expand and type == GLOBAL.BLOCKTYPES.HEAVY: + #look = 3 diff --git a/scenes/NewBlocks/block.tscn b/scenes/NewBlocks/block.tscn new file mode 100644 index 0000000..8810040 --- /dev/null +++ b/scenes/NewBlocks/block.tscn @@ -0,0 +1,64 @@ +[gd_scene load_steps=5 format=3 uid="uid://cbjkurbgojqac"] + +[ext_resource type="Script" path="res://scenes/NewBlocks/block.gd" id="1_booro"] + +[sub_resource type="Animation" id="Animation_1j0va"] +resource_name = "Expand" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(2, 2)] +} + +[sub_resource type="Animation" id="Animation_8wn5l"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(1, 1)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_u3jpa"] +_data = { +"Expand": SubResource("Animation_1j0va"), +"RESET": SubResource("Animation_8wn5l") +} + +[node name="Block" type="CharacterBody2D" groups=["Block"]] +collision_layer = 2 +collision_mask = 3 +script = ExtResource("1_booro") + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] + +[node name="PartPoints" type="Node2D" parent="."] + +[node name="RotationPoint" type="Marker2D" parent="."] + +[node name="PartsContainer" type="Node2D" parent="."] + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_u3jpa") +} + +[node name="CoyoteTimer" type="Timer" parent="."] +one_shot = true + +[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"] +[connection signal="timeout" from="CoyoteTimer" to="." method="_on_coyote_timer_timeout"] diff --git a/scenes/NewBlocks/part.gd b/scenes/NewBlocks/part.gd new file mode 100644 index 0000000..cceeab4 --- /dev/null +++ b/scenes/NewBlocks/part.gd @@ -0,0 +1,125 @@ +extends Area2D + +@onready var spriteBlock = $Sprites/Block +@onready var spriteSpecialBlock = $Sprites/SpecialBlock +@onready var spriteExpandBlock = $Sprites/ExpandBlock +@onready var spriteSpecialExpandedBlock = $Sprites/SpecialExpandedBlock + +@onready var rayTop = $Raycasts/RayTop +@onready var rayRight = $Raycasts/RayRight +@onready var rayBottom = $Raycasts/RayBottom +@onready var rayLeft = $Raycasts/RayLeft + +#func _physics_process(delta: float) -> void: + ##if GLOBAL.blockStopped and not GLOBAL.rowRemoved: + #if GLOBAL.currentID != get_parent().get_parent().id: + #removeOverlapp() + +func isOverlapping() -> bool: + var collided = false + for i in get_children(): + if is_instance_of(i,RayCast2D): + i.force_raycast_update() + var collider = i.get_collider() + if collider != null: + collided = true + return collided + +func removeOverlapp(): + var blocksSplit = [] + 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 + match look: + 0: + spriteBlock.show() + 1: + spriteSpecialBlock.show() + 2: + spriteExpandBlock.show() + 3: + spriteSpecialExpandedBlock.show() + + +func isTopColliding(): + rayTop.force_raycast_update() + if rayTop.get_collider() == null: + return false + + elif rayTop.get_collider().is_in_group("Block"): + if rayTop.get_collider().id == GLOBAL.currentID: + return false + else: + return true + else: + return true + +func isRightColliding(): + rayRight.force_raycast_update() + #print(rayRight.get_collider()) + if rayRight.get_collider() == null: + return false + elif rayRight.get_collider().is_in_group("Block"): + #print(rayRight.get_collider().id) + + if rayRight.get_collider().id == GLOBAL.currentID: + return false + else: + return true + else: + return true + +func isBottomColliding(): + rayBottom.force_raycast_update() + if rayBottom.get_collider() == null: + return false + + elif rayBottom.get_collider().is_in_group("Block"): + if rayBottom.get_collider().id == GLOBAL.currentID: + return false + else: + return true + else: + return true + +func isLeftColliding(): + + rayLeft.force_raycast_update() + #print(rayLeft.get_collider()) + if rayLeft.get_collider() == null: + return false + + elif rayLeft.get_collider().is_in_group("Block"): + #print(rayLeft.get_collider().id) + if rayLeft.get_collider().id == GLOBAL.currentID: + return false + else: + return true + else: + return true diff --git a/scenes/NewBlocks/part.tscn b/scenes/NewBlocks/part.tscn new file mode 100644 index 0000000..dc33cda --- /dev/null +++ b/scenes/NewBlocks/part.tscn @@ -0,0 +1,69 @@ +[gd_scene load_steps=7 format=3 uid="uid://dj8heengghud2"] + +[ext_resource type="Script" path="res://scenes/NewBlocks/part.gd" id="1_hlmu7"] +[ext_resource type="Texture2D" uid="uid://cbuxv7iwn0qm7" path="res://assets/Blocks/Block.png" id="1_m2ybm"] +[ext_resource type="Texture2D" uid="uid://dni2qahrw2p0k" path="res://assets/Blocks/SpecialBlock.png" id="2_jv3te"] +[ext_resource type="Texture2D" uid="uid://jmobplsqdy6o" path="res://assets/Blocks/ExpandBlock.png" id="3_yu63x"] +[ext_resource type="Texture2D" uid="uid://13wfksnp806p" path="res://assets/Blocks/SpecialExpandedBlock.png" id="4_yg0r6"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ix7xn"] +size = Vector2(48, 48) + +[node name="Part" type="Area2D" groups=["Part"]] +collision_layer = 8 +collision_mask = 16 +script = ExtResource("1_hlmu7") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_ix7xn") + +[node name="Sprites" type="Node2D" parent="."] + +[node name="Block" type="Sprite2D" parent="Sprites"] +visible = false +texture = ExtResource("1_m2ybm") + +[node name="SpecialBlock" type="Sprite2D" parent="Sprites"] +visible = false +texture = ExtResource("2_jv3te") + +[node name="ExpandBlock" type="Sprite2D" parent="Sprites"] +visible = false +texture = ExtResource("3_yu63x") + +[node name="SpecialExpandedBlock" type="Sprite2D" parent="Sprites"] +visible = false +texture = ExtResource("4_yg0r6") + +[node name="Raycasts" type="Node2D" parent="."] + +[node name="RayTop" type="RayCast2D" parent="Raycasts"] +position = Vector2(0, -32) +target_position = Vector2(0, 0) +collision_mask = 3 +hit_from_inside = true + +[node name="RayRight" type="RayCast2D" parent="Raycasts"] +position = Vector2(32, 0) +target_position = Vector2(0, 0) +collision_mask = 3 +hit_from_inside = true + +[node name="RayBottom" type="RayCast2D" parent="Raycasts"] +position = Vector2(0, 32) +target_position = Vector2(0, 0) +collision_mask = 3 +hit_from_inside = true + +[node name="RayLeft" type="RayCast2D" parent="Raycasts"] +position = Vector2(-32, 0) +target_position = Vector2(0, 0) +collision_mask = 3 +hit_from_inside = true + +[node name="Area2D" type="Area2D" parent="."] +collision_layer = 16 +collision_mask = 8 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +shape = SubResource("RectangleShape2D_ix7xn") diff --git a/scenes/ScoreOverview/score_overview.gd b/scenes/ScoreOverview/score_overview.gd index df56329..4745ea0 100644 --- a/scenes/ScoreOverview/score_overview.gd +++ b/scenes/ScoreOverview/score_overview.gd @@ -1,25 +1,24 @@ extends Control @onready var score = $VBoxContainer3/VBoxContainer2/ScoreValue -@onready var time = $VBoxContainer3/VBoxContainer/TimeValue +@onready var time = $VBoxContainer3/VBoxContainer/Time +@onready var timeValue = $VBoxContainer3/VBoxContainer/TimeValue +@onready var mode = $VBoxContainer3/VBoxContainer3/ModeValue # Called when the node enters the scene tree for the first time. func _ready() -> void: score.text = str(GLOBAL.points) - time.text = str(GLOBAL.time) + timeValue.text = str(GLOBAL.convertIntToTime(GLOBAL.time)) + if GLOBAL.currentMode == GLOBAL.MODES.INFINITE: + time.text = "Time Played" + mode.text = "Infinite" + elif GLOBAL.currentMode == GLOBAL.MODES.TIME: + time.text = "Time Left" + mode.text = "Time" GLOBAL.resetGame() - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass - - - - func _on_play_again_button_pressed() -> void: - get_parent().get_parent().laodGrid() - + get_parent().get_parent().loadGrid() func _on_home_pressed() -> void: get_parent().get_parent().loadStartMenu() diff --git a/scenes/ScoreOverview/score_overview.tscn b/scenes/ScoreOverview/score_overview.tscn index 59c7512..819c025 100644 --- a/scenes/ScoreOverview/score_overview.tscn +++ b/scenes/ScoreOverview/score_overview.tscn @@ -32,6 +32,22 @@ offset_bottom = 182.0 grow_horizontal = 2 grow_vertical = 2 +[node name="VBoxContainer3" type="VBoxContainer" parent="VBoxContainer3"] +layout_mode = 2 +alignment = 1 + +[node name="Mode" type="Label" parent="VBoxContainer3/VBoxContainer3"] +layout_mode = 2 +text = "Mode +" +label_settings = ExtResource("2_4dys4") +horizontal_alignment = 1 + +[node name="ModeValue" type="Label" parent="VBoxContainer3/VBoxContainer3"] +layout_mode = 2 +label_settings = ExtResource("4_dfemu") +horizontal_alignment = 1 + [node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer3"] layout_mode = 2 alignment = 1