From fdfb6a7d39bd6d3ad7e36cead8a4a25ce7a1ea38 Mon Sep 17 00:00:00 2001 From: Exobyt Date: Tue, 20 Aug 2024 12:17:01 +0200 Subject: [PATCH] Fixed Bugs; Added Mobile Support --- Theme/button_normal.tres | 10 + Theme/button_pressedl.tres | 10 + Theme/main.tres | 12 ++ assets/Buttons/BasicButton.png | Bin 0 -> 615 bytes assets/Buttons/BasicButton.png.import | 34 ++++ assets/Buttons/BasicButton.pxo | Bin 0 -> 1467 bytes assets/Buttons/BasicButton_normal.png | Bin 0 -> 615 bytes assets/Buttons/BasicButton_normal.png.import | 34 ++++ assets/Buttons/BasicButton_pressed.png | Bin 0 -> 615 bytes assets/Buttons/BasicButton_pressed.png.import | 34 ++++ assets/Buttons/DownArrow.png | Bin 0 -> 170 bytes assets/Buttons/DownArrow.png.import | 34 ++++ assets/Buttons/DownArrow.pxo | Bin 0 -> 633 bytes assets/Buttons/LeftArrow.png | Bin 0 -> 163 bytes assets/Buttons/LeftArrow.png.import | 34 ++++ assets/Buttons/LeftArrow.pxo | Bin 0 -> 640 bytes assets/Buttons/RightArrow.png | Bin 0 -> 164 bytes assets/Buttons/RightArrow.png.import | 34 ++++ assets/Buttons/RightArrow.pxo | Bin 0 -> 644 bytes assets/Buttons/RotationLeft.png | Bin 0 -> 243 bytes assets/Buttons/RotationLeft.png.import | 34 ++++ assets/Buttons/RotationLeft.pxo | Bin 0 -> 688 bytes assets/Buttons/RotationRight.png | Bin 0 -> 248 bytes assets/Buttons/RotationRight.png.import | 34 ++++ assets/Buttons/RotationRight.pxo | Bin 0 -> 690 bytes assets/RightArrow.png.import | 34 ++++ project.godot | 11 +- scenes/Globals/global.gd | 22 ++- scenes/Grid/camera_2d.gd | 14 ++ scenes/Grid/grid.gd | 163 ++++++++++------ scenes/Grid/grid.tscn | 180 +++++++++++++++++- scenes/Grid/lose_area.tscn | 5 + scenes/Main/control.gd | 47 +++++ scenes/Main/main.gd | 12 -- scenes/Main/main.tscn | 67 +------ 35 files changed, 709 insertions(+), 150 deletions(-) create mode 100644 Theme/button_normal.tres create mode 100644 Theme/button_pressedl.tres create mode 100644 Theme/main.tres create mode 100644 assets/Buttons/BasicButton.png create mode 100644 assets/Buttons/BasicButton.png.import create mode 100644 assets/Buttons/BasicButton.pxo create mode 100644 assets/Buttons/BasicButton_normal.png create mode 100644 assets/Buttons/BasicButton_normal.png.import create mode 100644 assets/Buttons/BasicButton_pressed.png create mode 100644 assets/Buttons/BasicButton_pressed.png.import create mode 100644 assets/Buttons/DownArrow.png create mode 100644 assets/Buttons/DownArrow.png.import create mode 100644 assets/Buttons/DownArrow.pxo create mode 100644 assets/Buttons/LeftArrow.png create mode 100644 assets/Buttons/LeftArrow.png.import create mode 100644 assets/Buttons/LeftArrow.pxo create mode 100644 assets/Buttons/RightArrow.png create mode 100644 assets/Buttons/RightArrow.png.import create mode 100644 assets/Buttons/RightArrow.pxo create mode 100644 assets/Buttons/RotationLeft.png create mode 100644 assets/Buttons/RotationLeft.png.import create mode 100644 assets/Buttons/RotationLeft.pxo create mode 100644 assets/Buttons/RotationRight.png create mode 100644 assets/Buttons/RotationRight.png.import create mode 100644 assets/Buttons/RotationRight.pxo create mode 100644 assets/RightArrow.png.import create mode 100644 scenes/Grid/camera_2d.gd create mode 100644 scenes/Grid/lose_area.tscn create mode 100644 scenes/Main/control.gd diff --git a/Theme/button_normal.tres b/Theme/button_normal.tres new file mode 100644 index 0000000..9619788 --- /dev/null +++ b/Theme/button_normal.tres @@ -0,0 +1,10 @@ +[gd_resource type="StyleBoxTexture" load_steps=2 format=3 uid="uid://dj3hx8vj1mid1"] + +[ext_resource type="Texture2D" uid="uid://b2s6ir44pjyg1" path="res://assets/Buttons/BasicButton_normal.png" id="1_arer0"] + +[resource] +texture = ExtResource("1_arer0") +texture_margin_left = 30.0 +texture_margin_top = 30.0 +texture_margin_right = 30.0 +texture_margin_bottom = 30.0 diff --git a/Theme/button_pressedl.tres b/Theme/button_pressedl.tres new file mode 100644 index 0000000..67464a2 --- /dev/null +++ b/Theme/button_pressedl.tres @@ -0,0 +1,10 @@ +[gd_resource type="StyleBoxTexture" load_steps=2 format=3 uid="uid://ddgwjywgelxnh"] + +[ext_resource type="Texture2D" uid="uid://fhfxfbphnrlq" path="res://assets/Buttons/BasicButton_pressed.png" id="1_hjs03"] + +[resource] +texture = ExtResource("1_hjs03") +texture_margin_left = 30.0 +texture_margin_top = 30.0 +texture_margin_right = 30.0 +texture_margin_bottom = 30.0 diff --git a/Theme/main.tres b/Theme/main.tres new file mode 100644 index 0000000..7c7a29d --- /dev/null +++ b/Theme/main.tres @@ -0,0 +1,12 @@ +[gd_resource type="Theme" load_steps=4 format=3 uid="uid://1nebbd65iyce"] + +[ext_resource type="StyleBox" uid="uid://dj3hx8vj1mid1" path="res://Theme/button_normal.tres" id="1_0lddq"] +[ext_resource type="StyleBox" uid="uid://ddgwjywgelxnh" path="res://Theme/button_pressedl.tres" id="2_eqhtm"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_rp1q2"] + +[resource] +Button/styles/focus = SubResource("StyleBoxTexture_rp1q2") +Button/styles/hover = ExtResource("1_0lddq") +Button/styles/normal = ExtResource("1_0lddq") +Button/styles/pressed = ExtResource("2_eqhtm") diff --git a/assets/Buttons/BasicButton.png b/assets/Buttons/BasicButton.png new file mode 100644 index 0000000000000000000000000000000000000000..1766cc78342499bf9526f6b7cdcd17f7607639c4 GIT binary patch literal 615 zcmV-t0+{`YP)Px%AxT6*RCt{2o84{2APj|R)jhHSQ)KK+!3LS6ee#t{_^}O%jpFaEw*k&MmWjj098pnAzT8Wu76GQ05^n^w_*kK z*1rYw05yb~C-D-nU>+FJ!VX}@i{~yR+C&v#Y4!oBCRPBJXCL5dWLJR2*#{)rhBrd1 zLk?ht@&`CtSruTp`~j{;Ujo_!wDAD61!&^|XbaHB1JD+rjR(MaI6twm2v;LHfRzqN zIa+-Qa2r@&1`=(o09IHAT#ce7V6h6Mn%DtYt^$cR@k`KB6^v*p20%S!u@C}ipq^&s zTmqopv9k~Y)jUx0Hnb1W41sID#_&c+BZOJzLudpbxqD}*M2fn;*}pwwOIADImdC{%^xJcE%ljN%##2B002ovPDHLkV1m}I B3orlx literal 0 HcmV?d00001 diff --git a/assets/Buttons/BasicButton.png.import b/assets/Buttons/BasicButton.png.import new file mode 100644 index 0000000..e27e1f8 --- /dev/null +++ b/assets/Buttons/BasicButton.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://blauiujlkoh1x" +path="res://.godot/imported/BasicButton.png-de86cb5cc582db65ec033a502603129b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Buttons/BasicButton.png" +dest_files=["res://.godot/imported/BasicButton.png-de86cb5cc582db65ec033a502603129b.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/Buttons/BasicButton.pxo b/assets/Buttons/BasicButton.pxo new file mode 100644 index 0000000000000000000000000000000000000000..4a8e2d04b7e6f9d1932ef0499ca9d7d454b74199 GIT binary patch literal 1467 zcmWIWW@Zs#VBp|jP!tr2G*r~{j%Q?Gh+}48;ACK6NJ%V7)XOT)&)XX0n}5iF=dbqU z^Q;GFRJ{<)+@It$@%AoNCErCVZ=(eM*ZSGBRaF8a^QL@yy+iBU9tX!PE-9{v zB!?4v*I9awI<+xw%4JGdEcLYQ-=(&HP4e2**9IPo-CxWTIk;=;(FYfl)?$D*MsgHs@J;vZ|Evb~Y{ z;dTirMS=NwFZ3AQML(`+YRTCU_wL!#nJn?vwKE?l_O-XA?{bV#{`$i1uIkG^NygVR zr5}a&-WJ|_;^*pLOD~ouNaWuAbh!6Ja$VTPs-mP%yg4hKb^jX1y$HVg@E2nMN-X@d zQ?xGv#sY%_1A{b>%FInnPmKq~g??I5Vs2`&zM+0jVr6Pkyy4rKr+J$lcwB;6WiN34 z-99DeVwc9Zia(L5IzJ`$ynowp;#1Yi5UtQP>t0ude{;F_*urbqX?OAU*WK01%~v01 zoxFE8_ty{oZ*r9efYA^Hoj*|8q*Yv#1pseSaF8IsQ={IFAtu&KT9dB z|2(0R-zT-->coTfY3{NqAIdi>^R4-FExT-UwQR(EMr$B9;?LbP{(M?LmcQMr&aCq< zFU*8F@ZZYn{Id+r`)38-NWAUGfGgq_scYiJK zF|GKySn|iyN8!fLmENr3DJe^NUtWG7Azt>)gNOUV*nXSyPmWphI;l81CgfMetk{EZ zzD~S(caPT8tpC3lP^0SF@&|8;iz*{nR9zMXMb-3)qftfssA6PdV8C6v0kakZD4Rh5 zysQiGM%9L%9bp<67}|ik@nlYPgU}NT!XQInd5ha1qX2JKHjrXwAUp}A@34S)01+XA A-v9sr literal 0 HcmV?d00001 diff --git a/assets/Buttons/BasicButton_normal.png b/assets/Buttons/BasicButton_normal.png new file mode 100644 index 0000000000000000000000000000000000000000..5ac5a700328154dcb29818c9e3ff910677abb193 GIT binary patch literal 615 zcmV-t0+{`YP)Px%AxT6*RCt{2o84{2APj|R)jhHS8)dp|#0Ht9ee#t{_^}O%jpFaEw*k&MmWjj098pnAzT8Wu76GQ05^n^w_*kK z*1rYw05yb~C-D-nU>+FJ!VX}@i{~yR+C&v#Y4!oBCRPBJXCL5dWLJR2*#{)rhBrd1 zLk?ht@&`CtSruTp`~j{;Ujo_!wDAD61!&^|XbaHB1JD+rjR(MaI6twm2v;LHfRzqN zIa+-Qa2r@&1`=(o09IHAT#ce7V6h6Mn%DtYt^$cR@k`KB6^v*p20%S!u@C}ipq^&s zTmqopv9k~Y)jUx0Hnb1W41sID#_&c+BZOJzLudpbxqD}*M2fn;*}pwwOIADImdC{%^y>DE%o^0WQYI&002ovPDHLkV1h?v B3q}9{ literal 0 HcmV?d00001 diff --git a/assets/Buttons/BasicButton_normal.png.import b/assets/Buttons/BasicButton_normal.png.import new file mode 100644 index 0000000..d7dc255 --- /dev/null +++ b/assets/Buttons/BasicButton_normal.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b2s6ir44pjyg1" +path="res://.godot/imported/BasicButton_normal.png-d7036cb5a6690c189f5e324307f41b8a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Buttons/BasicButton_normal.png" +dest_files=["res://.godot/imported/BasicButton_normal.png-d7036cb5a6690c189f5e324307f41b8a.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/Buttons/BasicButton_pressed.png b/assets/Buttons/BasicButton_pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..1766cc78342499bf9526f6b7cdcd17f7607639c4 GIT binary patch literal 615 zcmV-t0+{`YP)Px%AxT6*RCt{2o84{2APj|R)jhHSQ)KK+!3LS6ee#t{_^}O%jpFaEw*k&MmWjj098pnAzT8Wu76GQ05^n^w_*kK z*1rYw05yb~C-D-nU>+FJ!VX}@i{~yR+C&v#Y4!oBCRPBJXCL5dWLJR2*#{)rhBrd1 zLk?ht@&`CtSruTp`~j{;Ujo_!wDAD61!&^|XbaHB1JD+rjR(MaI6twm2v;LHfRzqN zIa+-Qa2r@&1`=(o09IHAT#ce7V6h6Mn%DtYt^$cR@k`KB6^v*p20%S!u@C}ipq^&s zTmqopv9k~Y)jUx0Hnb1W41sID#_&c+BZOJzLudpbxqD}*M2fn;*}pwwOIADImdC{%^xJcE%ljN%##2B002ovPDHLkV1m}I B3orlx literal 0 HcmV?d00001 diff --git a/assets/Buttons/BasicButton_pressed.png.import b/assets/Buttons/BasicButton_pressed.png.import new file mode 100644 index 0000000..92b36c6 --- /dev/null +++ b/assets/Buttons/BasicButton_pressed.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://fhfxfbphnrlq" +path="res://.godot/imported/BasicButton_pressed.png-3063cea8580bc519ff3700f7111f9a82.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Buttons/BasicButton_pressed.png" +dest_files=["res://.godot/imported/BasicButton_pressed.png-3063cea8580bc519ff3700f7111f9a82.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/Buttons/DownArrow.png b/assets/Buttons/DownArrow.png new file mode 100644 index 0000000000000000000000000000000000000000..f68d00d182f697de6713f95e328754116afc3071 GIT binary patch literal 170 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}DV{ElArY-_ zry24!81Nhs`uG2Nav~$AsilBu!u!2ZGi4a-)$g`X+9G{w%Qms_2YLby42qVXlu z(+&%^69qdYG~VxYaQVwM*CxCCj>n?gZDAhsJS`Hf_IBwn>^*MZ=D(5Yc#VQ$!m9|N Pbqoxiu6{1-oD!M<%W^p^ literal 0 HcmV?d00001 diff --git a/assets/Buttons/DownArrow.png.import b/assets/Buttons/DownArrow.png.import new file mode 100644 index 0000000..d9f26e3 --- /dev/null +++ b/assets/Buttons/DownArrow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cevua7g7nsrfj" +path="res://.godot/imported/DownArrow.png-daaf4af3e32a18e4ff2950887dc075d6.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Buttons/DownArrow.png" +dest_files=["res://.godot/imported/DownArrow.png-daaf4af3e32a18e4ff2950887dc075d6.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/Buttons/DownArrow.pxo b/assets/Buttons/DownArrow.pxo new file mode 100644 index 0000000000000000000000000000000000000000..4a16ecce0fcd92779243e514aeff710cf8acd114 GIT binary patch literal 633 zcmWIWW@Zs#VBp|jcpo7WdFAcaFCL5x3{6Z744e!M3@M2viF#SZ`FXh$@8&fd@U+IK zellHqYC_q;yG!0`F4Hnf$hb1W#dE=u(EGJ~7wmJxBkW{;*PLV3GXKF`sZsw;@nVWoU($3FgYj>2g^*+B$rK~w8Pf*mY==2+}iFq#hQnP}uc|~cLs#kq+ z*N6_8XHk7SNH#AmSbpWs?DY@BHofmM+57a&(w8bi9RWf1x94fTfx}5s3F`(y+QSjjz`Q^839y6<{|2LW09+mQ7g=$>r%eech^rhluuRA?MUM$_u`%C+X&bP(LTJGPNk)@a?&SoD2>eM;w0V-}=q{=w}40r__uYf?q!i*g?R)TdQ|HE0+`b z_P+VjIytpBZxS!{@k^WCeZd&u%?ON6+>s1&05Hy>03PM&+Rz;f)4;%x57dpv=>guX QY#_xCe0Q2tbU;qFB literal 0 HcmV?d00001 diff --git a/assets/Buttons/LeftArrow.png b/assets/Buttons/LeftArrow.png new file mode 100644 index 0000000000000000000000000000000000000000..3f12c60388296b41fcb77e71df5e28e79031f11f GIT binary patch literal 163 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}v7RoDArY-_ zFYRVzP~>3>c=XRYySR6LhEztMc|(HGfiq{gezkurTis&Z5${kd1pP% literal 0 HcmV?d00001 diff --git a/assets/Buttons/LeftArrow.png.import b/assets/Buttons/LeftArrow.png.import new file mode 100644 index 0000000..6780fe4 --- /dev/null +++ b/assets/Buttons/LeftArrow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bfji7a4suq6a1" +path="res://.godot/imported/LeftArrow.png-b0c7ed511e95f0ad98a63d99e4188378.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Buttons/LeftArrow.png" +dest_files=["res://.godot/imported/LeftArrow.png-b0c7ed511e95f0ad98a63d99e4188378.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/Buttons/LeftArrow.pxo b/assets/Buttons/LeftArrow.pxo new file mode 100644 index 0000000000000000000000000000000000000000..262a55e4f89e22bf8b26bcb42abcf361ea59e178 GIT binary patch literal 640 zcmWIWW@Zs#VBp|j@aGqa6graF;l;?n(9FcZz{$YCkdj!EsFziopO-uFd|tBw&$0N_ zPcy?(J**3EC+cr_9pcKyvz5zp3X50N*SqN&U;4KRPqVlC{o7JpBj!E-6UF~G)g2a_ z>aCa+9kjJjmhD9O`rKYwN51=aWDYGae#XLiCG3yiKskYT?)>XAP_Rd?Hep$uLHaz>7nDWlsZx*S>t~?iFa$F~R+qBZf zR$tstWarp={@At5XiZwM+{#_q>mQ13S>I%`cj=*}FPEqZT-{W+%{DlqWXV$>>6Ok~ zwyQ8#Pb-+fe*H4bhg~N=d90n7yilqoby=I@-FMqw9%G*~=hNj3xvXgoi)W>TdUjdo zT+6Pon>gB*YX%^<+QAPuB4a}(23<3Yi$ zpH`HZn_8@IsGpNqnOYQY`1XP!7lQ)N(F^zfU)p8i5m+eDJZby%8YxB3S(>~z)qbfe z-ZuZe_?u?R?^e6N|F5>)y&e3b?w-S!-@GC5lj=ek1H2i5v5GscL9PHsJruxW9$g!{ di(wiV7z%;9@wh+0o0ScumO}?5 z+MH&SyZLwxqhz+jH`cQU`EIV-{BTkx^WKNk8ZLhL)Nr$ap+P0~)@B7>0o6anK${pm MUHx3vIVCg!0AM&fAOHXW literal 0 HcmV?d00001 diff --git a/assets/Buttons/RightArrow.png.import b/assets/Buttons/RightArrow.png.import new file mode 100644 index 0000000..611db24 --- /dev/null +++ b/assets/Buttons/RightArrow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dsg7p035f3g52" +path="res://.godot/imported/RightArrow.png-8558667dcf0e5c07a5563c83a281291f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Buttons/RightArrow.png" +dest_files=["res://.godot/imported/RightArrow.png-8558667dcf0e5c07a5563c83a281291f.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/Buttons/RightArrow.pxo b/assets/Buttons/RightArrow.pxo new file mode 100644 index 0000000000000000000000000000000000000000..809ee11bc6e87d09b247c57a39b620d1cb437127 GIT binary patch literal 644 zcmWIWW@Zs#VBp|j;NlmFJE!d z^;XP^4%%8M%XXstd~UC-BVYU-nM3Wx&p0@*g#CH{sZ_~t@wtGY-6FEAYYY^gJojcg zmUL3lX`Wg^&>C&2)Wfb};d>7sa65l#ai-Ahd8@OJi7D?)ExR~rT}ZmttmJ9B(WiF> z%Knl+k)31f`D52IqnNYH{w#d8%(gxHq8<08FO#^YFIzmzA>{P0i{CsFFHW3hoV$eY zqMj$)H=TzH{Ogu;KB%1dbYhh9aVJxb(>}b;yYA**?&Y_ze7gMNovS*G?xrVKO%f@; z5wrf`PZzJe8GF~2#=O39(ocM<>6-LkI(PS}MrzG#IQxq4a<||2;Kf=OHt+BIrF}&5 z&AtBe!~6f5y1zfUvQ>s9%i-)lgS{7ZumAhR9e@(#F^hb@Ist>4L4bil8c1d4CZ?yx zg92VZttc@!wOHR!KPRy=wJ6^3?FB%x-3-&fz)%d-jmHN8-mGjO#Y{lh0Hoi6Edv1JMDo}G literal 0 HcmV?d00001 diff --git a/assets/Buttons/RotationLeft.png b/assets/Buttons/RotationLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..99a590dbc19353413a2456c6be2121ba0c913685 GIT binary patch literal 243 zcmVPx#tw}^dR9J=Wmcb5yAPhq{n literal 0 HcmV?d00001 diff --git a/assets/Buttons/RotationLeft.png.import b/assets/Buttons/RotationLeft.png.import new file mode 100644 index 0000000..de61ddd --- /dev/null +++ b/assets/Buttons/RotationLeft.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ct4dkk00pyv6v" +path="res://.godot/imported/RotationLeft.png-914b1c6fbc338ab04fd0f63963fc5cd9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Buttons/RotationLeft.png" +dest_files=["res://.godot/imported/RotationLeft.png-914b1c6fbc338ab04fd0f63963fc5cd9.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/Buttons/RotationLeft.pxo b/assets/Buttons/RotationLeft.pxo new file mode 100644 index 0000000000000000000000000000000000000000..3b85eee81f61a46f0da1f6435cc86cc8196175e8 GIT binary patch literal 688 zcmWIWW@Zs#VBp|jC>0cmOx|;3lM5pQLn9Ld11AFmLrP*vqFz>UeqQdxi+RlkJg)Vr zpN!X@n(*zw?|n(Dl$hJ1cs-}Eu&w>|zF1?;+HLAO@#|{)i(60eKXhR{wLY26#Papx ztjNh(Yu_6>RaWFmzv1+f@OiRgWg}0N`aAxgRTD2Q(7v+dy{o^VbPvbVuhSY!BZ}uN zJY&2=!;IJ0=)YR`?1RZE*?P;%e%*?Hwc4GE7sXW%-YffB<){AM|7s?bk>+I&YGY>6PS9ZVUDVtvIZ&Z}P z$)5U!S+(K1YoGe1u)fwTk!h_`$7KG3SIrXnek1ofM~$MY zxz4@oRdKI(PM=#Bc5YMTi*6h3qC%H9VfjAmXRceW7Ml2A1Me^GGu+n}+uQT}|8`x( zSz-OVI|?4kQhdw5IPG8Aw_QE}C8+OzEuUNl3}OZW1_o&$m6@BEo*EAdaQ(ER#N5<|{Ln2z= zPIDAGpuoYr@c(~f+schfESFzen5NHO!xb@cZfe@LSB15bacl{#(-~$wG+?lfadDaX zaMi4D%?uajDl0tIo59JrEbic8n?j)rb9)t{I@l!~54c`t|H^25V&VfSj&hbVr9G6hFVdQ&MBb@0Oc`XU;qFB literal 0 HcmV?d00001 diff --git a/assets/Buttons/RotationRight.png.import b/assets/Buttons/RotationRight.png.import new file mode 100644 index 0000000..c9ffcf7 --- /dev/null +++ b/assets/Buttons/RotationRight.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5gbnb7gtwww3" +path="res://.godot/imported/RotationRight.png-76811f2593715fe1e653e9bd3b4cb6b4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Buttons/RotationRight.png" +dest_files=["res://.godot/imported/RotationRight.png-76811f2593715fe1e653e9bd3b4cb6b4.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/Buttons/RotationRight.pxo b/assets/Buttons/RotationRight.pxo new file mode 100644 index 0000000000000000000000000000000000000000..fffea9adcb186b3047696eb76f855c055174fb5b GIT binary patch literal 690 zcmWIWW@Zs#VBp|jm?|g|dF6_3sV5@?Ln{*l11AFmLrP*vqFz>UeqQcG-~46+p0@v| zo*1t^HKFXmzT1Ag{X$a?EWD`DIq87M>VMxYYrZ(&<~*&x{;%CRRxR@%!j&5P`y?-< z^m03`>T5Ascbwtr!<}n4s%t#F%))c(1^*;QqY2a0_k6s*aZX$8f@OJ{Ra`d`95nQ= z^Yk2zYUN0scQ8`p?u8@P>-OxCykk=|P0rUdhy7}frghJgX*WaNcM0yz%;1YEKNYn! z`r_jMZ9z%TJ0E*{mfkqC?BB9y%WT`DAKufx^ktIq^kwoB9bA@wS^Re5p+(AP+iw-h zE{dJhb4r_!J+**Ywc)vInC}%yJF%{bk!e{HpZ_M#e_wOp$&>kN#o^sNGMTUr3fCr|w~iILreS+oyfW;`8;%?6?oEg@iS_qc1(R( z@A3Zsc3q@dU0p0MVTs_@Ps_hJZ4WvAT0a0Kyf2;cjw%L*GlKvFgEWxJ%uP&BjR%Fg zep*ptZfdc0w))4FUL_o1|^h@bUE7yjJf6LW8CK5lr4@nN;hgne6PAADaIcYjmirKx2% zY;)OfcKwRIbvt)a`9!`br5kbW9^0-q9(1$0amVj@_D+TXZ$@A`z@0ik4hJR{D1fIG jbZzLKglS-4C;;ll int: lastUID += 1 return lastUID + + +func resetGame(): + points = 0 + lastUID = 0 + currentUID = lastUID + time = 0 + lost = false + +func _ready() -> void: + resetGame() + +func lose(): + lost = true diff --git a/scenes/Grid/camera_2d.gd b/scenes/Grid/camera_2d.gd new file mode 100644 index 0000000..1b84783 --- /dev/null +++ b/scenes/Grid/camera_2d.gd @@ -0,0 +1,14 @@ +extends Camera2D + +@onready var scoreLabel = $CanvasLayer/Control/HBoxContainer/ScoreValue +@onready var timeLabel = $CanvasLayer/Control/HBoxContainer2/TimeValue + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# 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) diff --git a/scenes/Grid/grid.gd b/scenes/Grid/grid.gd index e317b56..9846de7 100644 --- a/scenes/Grid/grid.gd +++ b/scenes/Grid/grid.gd @@ -5,6 +5,10 @@ extends Node2D @onready var tickerTimer = $Ticker @onready var patterns = $Patterns @onready var turnTickTimer = $TurnTick +@onready var loseArea = $LoseArea +@onready var gameTimer = $GameTimer +@onready var coyoteTimer = $CoyoteTimer + var nextBlocks = [] @@ -16,6 +20,7 @@ var blockSpeed = 0.5 var stopped = false + func spawnBlock() -> void: var block = nextBlocks[0] GLOBAL.currentBlock = block @@ -31,18 +36,18 @@ func _ready() -> void: func _physics_process(delta: float) -> void: - #for i in $Borders.get_children(): - #for j in i.get_overlapping_areas(): - #if j.is_in_group("Block"): - #if j.get_parent().UID == GLOBAL.currentUID: - #for s in getBlockGroupsList()[j.get_parent().UID]: - #s.queue_free() - #else: - #j.get_parent().queue_free() - #for i in getBlockGroupsList(): - #if i != GLOBAL.currentUID: - #moveUidGroup(GLOBAL.Direction.BOTTOM, i) + for i in getBlockGroupsList(): + if i != GLOBAL.currentUID: + moveUidGroup(GLOBAL.Direction.BOTTOM, i) var blockGroups = getBlockGroupsList() + #if Input.is_action_pressed("down"): + + 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]: @@ -54,7 +59,6 @@ func _physics_process(delta: float) -> void: print(5*delta) 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]: @@ -181,8 +185,11 @@ func getNewPatterns(): newPatterns.append(load(GLOBAL.BLOCKSPATTERS[i]).instantiate()) newPatterns.shuffle() newPatterns[0].type = GLOBAL.BLOCKTYPES.HEAVY + newPatterns.shuffle() newPatterns[0].expand = true newPatterns.shuffle() + for i in newPatterns: + i.expand = true patternsArray.append_array(newPatterns) func turnBlocks(): @@ -202,60 +209,92 @@ func _on_turn_tick_timeout() -> void: func _on_ticker_timeout() -> void: stopped = true if getBlockedDirection(GLOBAL.Direction.BOTTOM, GLOBAL.currentUID): + coyoteTimer.start(0.1) - if currentPattern.expand: - if currentPattern.get_scale() != Vector2(2,2): - for i in getBlockGroupsList()[GLOBAL.currentUID]: - if i.turningPoint: - currentPattern.set_scale(Vector2(2,2)) - currentPattern.moveToPosition(i.global_position-spawnpoint.position - Vector2(64,64*4)) - if await currentPattern.getCollidingBorder() != []: - currentPattern.position.y -= 64 - for i in range(1,8): - if await currentPattern.getCollidingBorder() == []: - break - currentPattern.position.x -= 64 - currentPattern.position.x = 0 - for i in range(1,8): - if await currentPattern.getCollidingBorder() == []: - break - currentPattern.position.x += 64 - #if await currentPattern.getCollidingBorder() != []: - #currentPattern.position.y += 64 - - #if await currentPattern.getCollidingBorder() != []: - #currentPattern.position.x -= 64 - 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() - #for i in blocks.get_children(): - #if i.get_scale() != Vector2(2,2): - #i.set_scale(Vector2(2,2)) - #i.move(-64,-64) - #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) - #if i.turningPoint: - #currentPattern.global_position = i.global_position- Vector2(32,32) - - for i in $RowTests.get_children(): - if i.isCompleted(): - for j in i.getRow(): - splitOphansUID(j.UID) - GLOBAL.points += j.type - j.queue_free() - PlacePattern() for i in getBlockGroupsList(): moveUidGroup(GLOBAL.Direction.BOTTOM, i) tickerTimer.start(blockSpeed) stopped = false + + +func _on_game_timer_timeout() -> void: + if GLOBAL.time + 1 > 0: + GLOBAL.time += 1 + #else: + #GLOBAL.lose() + gameTimer.start(1) + + +func _on_coyote_timer_timeout() -> void: + for i in $RowTests.get_children(): + for j in getBlockGroupsList(): + if j != GLOBAL.currentUID: + moveUidGroup(GLOBAL.Direction.BOTTOM, i) + stopped = true + if loseArea.get_overlapping_areas() != []: + GLOBAL.lose() + if currentPattern.expand: + if currentPattern.get_scale() != Vector2(2,2): + for i in getBlockGroupsList()[GLOBAL.currentUID]: + if i.turningPoint: + currentPattern.set_scale(Vector2(2,2)) + currentPattern.moveToPosition(i.global_position-spawnpoint.position - Vector2(64,64*4)) + #if await currentPattern.getCollidingBorder() != []: + for i in await currentPattern.getCollidingBorder(): + if i.is_in_group("Floor"): + currentPattern.position.y -= 64 + elif i.is_in_group("LeftBorder"): + for j in range(1,8): + if await currentPattern.getCollidingBorder() == []: + break + currentPattern.position.x += 64 + elif i.is_in_group("RightBorder"): + for j in range(1,8): + if await currentPattern.getCollidingBorder() == []: + break + currentPattern.position.x -= 64 + #for i in range(1,8): + #print(await currentPattern.getCollidingBorder()) + #if await currentPattern.getCollidingBorder() == []: + #break + #currentPattern.position.x -= 64 + #currentPattern.position.x = 0 + #for i in range(1,8): + #if await currentPattern.getCollidingBorder() == []: + #break + #currentPattern.position.x += 64 + #if await currentPattern.getCollidingBorder() != []: + #currentPattern.position.y += 64 + + #if await currentPattern.getCollidingBorder() != []: + #currentPattern.position.x -= 64 + 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() + #for i in blocks.get_children(): + #if i.get_scale() != Vector2(2,2): + #i.set_scale(Vector2(2,2)) + #i.move(-64,-64) + #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) + #if i.turningPoint: + #currentPattern.global_position = i.global_position- Vector2(32,32) + + for i in $RowTests.get_children(): + if i.isCompleted(): + for j in i.getRow(): + splitOphansUID(j.UID) + GLOBAL.points += j.type + j.queue_free() + PlacePattern() diff --git a/scenes/Grid/grid.tscn b/scenes/Grid/grid.tscn index 1948e51..5d5bc9b 100644 --- a/scenes/Grid/grid.tscn +++ b/scenes/Grid/grid.tscn @@ -1,9 +1,19 @@ -[gd_scene load_steps=8 format=3 uid="uid://dwl4lotl1d3ij"] +[gd_scene load_steps=19 format=3 uid="uid://dwl4lotl1d3ij"] [ext_resource type="Script" path="res://scenes/Grid/grid.gd" id="1_vie5m"] [ext_resource type="PackedScene" uid="uid://bm7rshwf6pjb" path="res://scenes/Grid/border.tscn" id="4_3j08q"] [ext_resource type="PackedScene" uid="uid://duubii5uu3lgq" path="res://scenes/Grid/row_test.tscn" id="4_si3v6"] [ext_resource type="PackedScene" uid="uid://dvrotjxom4u6d" path="res://scenes/Grid/bottom.tscn" id="5_14njh"] +[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"] +[ext_resource type="LabelSettings" uid="uid://cd783ubpcytc8" path="res://Theme/label.tres" id="9_i2h5u"] +[ext_resource type="Texture2D" uid="uid://bfji7a4suq6a1" path="res://assets/Buttons/LeftArrow.png" id="10_vgg21"] +[ext_resource type="Texture2D" uid="uid://dsg7p035f3g52" path="res://assets/Buttons/RightArrow.png" id="11_pa3jp"] +[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"] [sub_resource type="QuadMesh" id="QuadMesh_qfjsc"] @@ -13,6 +23,9 @@ 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") @@ -104,19 +117,19 @@ one_shot = true [node name="Borders" type="Node2D" parent="."] -[node name="Border" parent="Borders" instance=ExtResource("4_3j08q")] +[node name="Border" parent="Borders" groups=["LeftBorder"] instance=ExtResource("4_3j08q")] [node name="CollisionShape2D" parent="Borders/Border" index="0"] position = Vector2(-64, 512) shape = SubResource("RectangleShape2D_flipi") -[node name="Border2" parent="Borders" instance=ExtResource("4_3j08q")] +[node name="Border2" parent="Borders" groups=["RightBorder"] instance=ExtResource("4_3j08q")] [node name="CollisionShape2D" parent="Borders/Border2" index="0"] position = Vector2(704, 512) shape = SubResource("RectangleShape2D_flipi") -[node name="Bottom" parent="." instance=ExtResource("5_14njh")] +[node name="Bottom" parent="." groups=["Floor"] instance=ExtResource("5_14njh")] position = Vector2(320, 1312) collision_mask = 2 @@ -124,8 +137,167 @@ collision_mask = 2 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") + +[node name="GameTimer" type="Timer" parent="."] +autostart = true + +[node name="Camera2D" type="Camera2D" parent="."] +position = Vector2(320, 640) +script = ExtResource("6_mbeib") + +[node name="CanvasLayer" type="CanvasLayer" parent="Camera2D"] + +[node name="Control" type="Control" parent="Camera2D/CanvasLayer"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("7_38u5s") +script = ExtResource("8_4bfjb") + +[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"] +layout_mode = 1 +offset_left = 56.0 +offset_top = 64.0 +offset_right = 320.0 +offset_bottom = 152.0 + +[node name="Score" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer"] +layout_mode = 2 +text = "Score: " +label_settings = ExtResource("9_i2h5u") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="ScoreValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer"] +layout_mode = 2 +label_settings = ExtResource("9_i2h5u") +horizontal_alignment = 1 + +[node name="HBoxContainer2" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -312.0 +offset_top = 64.0 +offset_right = -56.0 +offset_bottom = 152.0 +grow_horizontal = 0 +alignment = 2 + +[node name="TimeValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"] +layout_mode = 2 +label_settings = ExtResource("9_i2h5u") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Time" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"] +layout_mode = 2 +text = " :Time" +label_settings = ExtResource("9_i2h5u") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="HBoxContainer3" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"] +visible = false +modulate = Color(1, 1, 1, 0.588235) +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 64.0 +offset_top = -240.0 +offset_right = 252.0 +offset_bottom = -148.0 +grow_vertical = 0 +scale = Vector2(2, 2) +alignment = 2 + +[node name="left_Button" type="Button" parent="Camera2D/CanvasLayer/Control/HBoxContainer3"] +layout_mode = 2 +action_mode = 0 +icon = ExtResource("10_vgg21") +icon_alignment = 1 + +[node name="right_Button" type="Button" parent="Camera2D/CanvasLayer/Control/HBoxContainer3"] +layout_mode = 2 +action_mode = 0 +icon = ExtResource("11_pa3jp") +icon_alignment = 1 + +[node name="HBoxContainer4" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"] +visible = false +modulate = Color(1, 1, 1, 0.588235) +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -432.0 +offset_top = -240.0 +offset_right = -244.0 +offset_bottom = -148.0 +grow_horizontal = 0 +grow_vertical = 0 +scale = Vector2(2, 2) + +[node name="rotate_left_Button" type="Button" parent="Camera2D/CanvasLayer/Control/HBoxContainer4"] +layout_mode = 2 +action_mode = 0 +icon = ExtResource("12_qk3ju") +icon_alignment = 1 + +[node name="rotate_right_Button" type="Button" parent="Camera2D/CanvasLayer/Control/HBoxContainer4"] +layout_mode = 2 +action_mode = 0 +icon = ExtResource("13_kls78") +icon_alignment = 1 + +[node name="HBoxContainer5" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"] +visible = false +modulate = Color(1, 1, 1, 0.588235) +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -92.0 +offset_top = -240.0 +offset_right = 4.0 +offset_bottom = -148.0 +grow_horizontal = 2 +grow_vertical = 0 +scale = Vector2(2, 2) + +[node name="down_Button" type="Button" parent="Camera2D/CanvasLayer/Control/HBoxContainer5"] +layout_mode = 2 +action_mode = 0 +icon = ExtResource("14_i1yud") +icon_alignment = 1 + +[node name="CoyoteTimer" 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"] +[connection signal="pressed" from="Camera2D/CanvasLayer/Control/HBoxContainer4/rotate_left_Button" to="Camera2D/CanvasLayer/Control" method="_on_rotate_left_button_pressed"] +[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"] +[connection signal="timeout" from="CoyoteTimer" to="." method="_on_coyote_timer_timeout"] [editable path="Borders/Border"] [editable path="Borders/Border2"] diff --git a/scenes/Grid/lose_area.tscn b/scenes/Grid/lose_area.tscn new file mode 100644 index 0000000..c249bd4 --- /dev/null +++ b/scenes/Grid/lose_area.tscn @@ -0,0 +1,5 @@ +[gd_scene format=3 uid="uid://d2m5xvw4ucwfw"] + +[node name="LoseArea" type="Area2D"] +collision_layer = 64 +collision_mask = 2 diff --git a/scenes/Main/control.gd b/scenes/Main/control.gd new file mode 100644 index 0000000..31f31ff --- /dev/null +++ b/scenes/Main/control.gd @@ -0,0 +1,47 @@ +extends Control + +@onready var buttonContainer1 = $HBoxContainer3 +@onready var buttonContainer2 = $HBoxContainer4 +@onready var buttonContainer3 = $HBoxContainer5 +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + print(DisplayServer.mouse_get_position() != Vector2i()) + if DisplayServer.mouse_get_position() == Vector2i(): + buttonContainer1.show() + buttonContainer2.show() + buttonContainer3.show() + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + + +func _on_left_button_pressed() -> void: + Input.action_press("left") + Input.action_release("left") + + +func _on_right_button_pressed() -> void: + Input.action_press("right") + Input.action_release("right") + + +func _on_rotate_left_button_pressed() -> void: + Input.action_press("rotate_left") + Input.action_release("rotate_left") + + + +func _on_rotate_right_button_pressed() -> void: + Input.action_press("rotate_right") + Input.action_release("rotate_right") + + + +func _on_down_button_button_down() -> void: + Input.action_press("down") + + +func _on_down_button_button_up() -> void: + Input.action_press("down") + Input.action_release("down") diff --git a/scenes/Main/main.gd b/scenes/Main/main.gd index 7068f02..b489a64 100644 --- a/scenes/Main/main.gd +++ b/scenes/Main/main.gd @@ -1,17 +1,5 @@ extends Node -@onready var gameTimer = $GameTimer -@onready var scoreLabel = $Camera2D/CanvasLayer/Control/HBoxContainer/ScoreValue -@onready var timeLabel = $Camera2D/CanvasLayer/Control/HBoxContainer2/TimeValue - # Called when the node enters the scene tree for the first time. func _ready() -> void: pass # Replace with function body. - -func _physics_process(delta: float) -> void: - scoreLabel.text = str(GLOBAL.points) - timeLabel.text = str(GLOBAL.time) - -func _on_game_timer_timeout() -> void: - GLOBAL.time += 1 - gameTimer.start(1) diff --git a/scenes/Main/main.tscn b/scenes/Main/main.tscn index bee062c..1ef11e0 100644 --- a/scenes/Main/main.tscn +++ b/scenes/Main/main.tscn @@ -1,10 +1,8 @@ -[gd_scene load_steps=6 format=3 uid="uid://bq5hrqgv0f6hp"] +[gd_scene load_steps=4 format=3 uid="uid://bq5hrqgv0f6hp"] [ext_resource type="PackedScene" uid="uid://dwl4lotl1d3ij" path="res://scenes/Grid/grid.tscn" id="1_88eap"] [ext_resource type="Script" path="res://scenes/Main/main.gd" id="1_dtde6"] [ext_resource type="PackedScene" uid="uid://c03h0nwewolfx" path="res://scenes/Grid/SpeedScale.tscn" id="2_mnoeo"] -[ext_resource type="LabelSettings" uid="uid://cd783ubpcytc8" path="res://Theme/label.tres" id="3_jopb4"] -[ext_resource type="Script" path="res://scenes/Main/score_value.gd" id="3_vtvng"] [node name="main" type="Node"] script = ExtResource("1_dtde6") @@ -15,66 +13,3 @@ position = Vector2(128, 256) [node name="Node2D" parent="." instance=ExtResource("2_mnoeo")] visible = false position = Vector2(960, 896) - -[node name="Camera2D" type="Camera2D" parent="."] -position = Vector2(448, 896) - -[node name="CanvasLayer" type="CanvasLayer" parent="Camera2D"] - -[node name="Control" type="Control" parent="Camera2D/CanvasLayer"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"] -layout_mode = 1 -offset_left = 56.0 -offset_top = 64.0 -offset_right = 320.0 -offset_bottom = 152.0 - -[node name="Score" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer"] -layout_mode = 2 -text = "Score: " -label_settings = ExtResource("3_jopb4") -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="ScoreValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer"] -layout_mode = 2 -label_settings = ExtResource("3_jopb4") -horizontal_alignment = 1 -script = ExtResource("3_vtvng") - -[node name="HBoxContainer2" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control"] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -312.0 -offset_top = 64.0 -offset_right = -56.0 -offset_bottom = 152.0 -grow_horizontal = 0 -alignment = 2 - -[node name="TimeValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"] -layout_mode = 2 -label_settings = ExtResource("3_jopb4") -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="Time" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"] -layout_mode = 2 -text = " :Time" -label_settings = ExtResource("3_jopb4") -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="GameTimer" type="Timer" parent="."] -autostart = true - -[connection signal="timeout" from="GameTimer" to="." method="_on_game_timer_timeout"]