From 672e91d3819587ba2dbd4c1b9ff12ba23e7a6d1c Mon Sep 17 00:00:00 2001 From: Conor Edmonds Date: Sat, 31 Jan 2026 01:00:45 -0500 Subject: [PATCH] Saturday, 31 January 2026 01:00:43 --- Art/broken_shield.png | Bin 0 -> 5114 bytes Art/broken_shield.png.import | 40 +++++ Art/reg_shield.png | Bin 0 -> 3486 bytes Art/reg_shield.png.import | 40 +++++ Gameplay/Action.cs | 12 ++ Gameplay/Action.cs.uid | 1 + Gameplay/Actions/Example1.cs | 25 +++ Gameplay/Actions/Example1.cs.uid | 1 + Gameplay/Actor.cs | 199 --------------------- Gameplay/Board.cs | 51 +++--- Gameplay/Boss.cs | 8 +- Gameplay/BusinessCard.cs | 5 +- Gameplay/CallButton.cs | 2 +- Gameplay/Cell.cs | 46 ----- Gameplay/Contact.cs | 58 +++++- Gameplay/Contacts/Rotate90.cs | 7 - Gameplay/Contacts/Rotate90.cs.uid | 1 - Gameplay/Contacts/Shift1ColumnRight.cs | 7 - Gameplay/Contacts/Shift1ColumnRight.cs.uid | 1 - Gameplay/Contacts/ShuffleCells.cs | 7 - Gameplay/Contacts/ShuffleCells.cs.uid | 1 - Gameplay/Contacts/SlideBack2.cs | 7 - Gameplay/Contacts/SlideBack2.cs.uid | 1 - Gameplay/Contacts/Swap1And6.cs | 7 - Gameplay/Contacts/Swap1And6.cs.uid | 1 - Gameplay/Dragon.cs | 10 +- Gameplay/Enemy.cs | 12 +- Gameplay/Mook.cs | 4 +- Gameplay/Phone.cs | 30 ++-- Gameplay/PhoneButton.cs | 7 +- Gameplay/Player.cs | 18 +- Gameplay/Shield.cs | 66 +++++++ Gameplay/{Cell.cs.uid => Shield.cs.uid} | 0 Gameplay/action.tscn | 6 + Gameplay/board.tscn | 60 ++----- Gameplay/cell.tscn | 19 -- Gameplay/contact.tscn | 14 +- Gameplay/shield.tscn | 24 +++ 38 files changed, 374 insertions(+), 424 deletions(-) create mode 100644 Art/broken_shield.png create mode 100644 Art/broken_shield.png.import create mode 100644 Art/reg_shield.png create mode 100644 Art/reg_shield.png.import create mode 100644 Gameplay/Action.cs create mode 100644 Gameplay/Action.cs.uid create mode 100644 Gameplay/Actions/Example1.cs create mode 100644 Gameplay/Actions/Example1.cs.uid delete mode 100644 Gameplay/Cell.cs delete mode 100644 Gameplay/Contacts/Rotate90.cs delete mode 100644 Gameplay/Contacts/Rotate90.cs.uid delete mode 100644 Gameplay/Contacts/Shift1ColumnRight.cs delete mode 100644 Gameplay/Contacts/Shift1ColumnRight.cs.uid delete mode 100644 Gameplay/Contacts/ShuffleCells.cs delete mode 100644 Gameplay/Contacts/ShuffleCells.cs.uid delete mode 100644 Gameplay/Contacts/SlideBack2.cs delete mode 100644 Gameplay/Contacts/SlideBack2.cs.uid delete mode 100644 Gameplay/Contacts/Swap1And6.cs delete mode 100644 Gameplay/Contacts/Swap1And6.cs.uid create mode 100644 Gameplay/Shield.cs rename Gameplay/{Cell.cs.uid => Shield.cs.uid} (100%) create mode 100644 Gameplay/action.tscn delete mode 100644 Gameplay/cell.tscn create mode 100644 Gameplay/shield.tscn diff --git a/Art/broken_shield.png b/Art/broken_shield.png new file mode 100644 index 0000000000000000000000000000000000000000..4c9819c8f5bd49bd196db20527cc9816562947fc GIT binary patch literal 5114 zcmZ{ocTiJXw8lXsktPUILMIdf>7f^qo^UB5Vx$?m^b$IVfDsHW29PF2x?Va;Ac8=o zhAxOGJya>u#elR2-g*DMcV_Ri=X~?+wPyX+o;h<)+#M4G23k&93JMAa7*zM}`AWQ) zR{-bt$_G_>=gVb(ZP>jl=hx#aPU!Pz8egcTKLrIH%f+Omc$LFJLBWy()782clCzN; zT4!q!(XA;RN&~|RT}I!|d}D;=V7{yazAW~M^13sx1a6GYsu)KrdDl|v`lLlb^oBd` zDqSHsKiRT?U*cMHX`%qQC=N=%Ql?;wvt~B$}OX}-A1Vp z7bYH*?*^(poO|n%{+sJ19Y(2?5GW#+B6WO*-aLxOJiZqMNlFP)BKl6X&winQeo4nX z-mv37=?Mu;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Y1ymb7$RXgKZ ze9H25l4TJ}YIv5l5F`;D6V1hKqy4?zpWS=hZG4qNN}$5IvIj*Zkow;lMK$3K>1#&7lUG~+OW1Qu}>sjkT*c;M?@6DckH#8J97`)+` zu(G@(Xv1hZlc?7)eS6Ch;tN_@zbE5P(6tkoV_Xv7&E}nno=gk2pi^c0(&Ay82&Jd0 z68@M`ZdnO>JvYVT+w5HM!;3VdSR|J-Df3kMT1e71Fi_AtW}zm^KWXJOJ4rIf2edt$ zUOgfsClk9J-MPFY*JzROWPoz+G-@{NdaEm@}}%8g~`B) zID;Tn)7+C<>(G3qOJ|8(LmWvS3!dJxV*?#LDA`1QlLA~ltmtTK#&yRhlJT)n+dfF& zMW6Bv=AmI*(9K5jz&E_GzZaiHfLwosp(fP1!W}uNKhqp*)TAFL)^awer63yfYy3U)vGy-<@*jKkq1DdM3J6+ICO> E2P)OWJOBUy literal 0 HcmV?d00001 diff --git a/Art/broken_shield.png.import b/Art/broken_shield.png.import new file mode 100644 index 0000000..91d9ead --- /dev/null +++ b/Art/broken_shield.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b5oc4f3gxijq5" +path="res://.godot/imported/broken_shield.png-18bca4dc3aa93b7e622d775255883827.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/broken_shield.png" +dest_files=["res://.godot/imported/broken_shield.png-18bca4dc3aa93b7e622d775255883827.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/Art/reg_shield.png b/Art/reg_shield.png new file mode 100644 index 0000000000000000000000000000000000000000..33e885bcacdc5adad97279efc5dc25eea7310d52 GIT binary patch literal 3486 zcmd^C`9Bkm8{gp?IoitAu#xK{jpRrqGHg-q%6--NxaQ;I9NG}(PI8tGlSFJ{BgaNc zQVku(-Bz~AD-v+kR8w2N{TCr0{{R?jGeXfo__fs zi;3*X#}^x`_LNYx6~hLPJmArIUQLbT4z4yLZ-j4+gKq#V&NNl%H7aWS&2U*)^#=gS; z^%LnxB%cTUDY7YM#`-CAB$nccbjtpNSx})D0Rws}1b<^yCpZcq9rK%TN)PD-KSZ*n z1|H9%Cm5ZTapuyFs%IIU(?5U4!aRmF&O+MrKGmTUJ8rEK|HVFJr#CN zb@fta><^`iPP>r0s&8YGwn4RlE?-7R1c_b;S6nHY)kNusOr$661Hl6Hz{WgnHW(=N zOcrOJK|q#9CaB0OufZvmIxi>VQGwFU5=8R=Q6JDV;te92r4!V&IMpZR^}0OW@ck8@ z<%U-nKOCC}UK#=(!utViZ}A2Z?~0 znhlG=V2xTa`mB^%(g7a!)su_||7rl)uoUT}%h`UFeTM0b{(nZ^xHeKq9N80>Z0gkrQco8i@{H+VO@_N&{9M^h92zQhgJ#G4z%**`7M<(syp@eX={ zeb8#|+77}yXOqL*lqwf~klXIbotL1e%mBaE554`aH=h4Q%qDOfGRm#uv${CZ!EPUQ z6BHzGo&Rj)$pv~@Z^Wr+-`HV2e;-#r(b^#L_L;^7_YuD^2oL&|nfKMhJ>c7unzH=E z+gd@94Bt5Lomwjtyx(8?ZQdh_q7gO*S#io)B#o-vUFFnR^(yfd&F}Gfmte1&7BB;_ zZEFq=Ne5F;MCI8RVfVeXuhGA`CPvp!E9UOwJ+s6XO1*p71T6vG$yaWjpn|}>g-*i{ZWpoSteSR*6?D4suWgczo>dvR@(nVIO{s1Rctr&cYj( z4N*nI{*iMc3ymq_c`qmK7dFe!CwS#$PXx4rD$NT%q1dM>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Z7)lgPs$o&J|>Fa?(;c9re)Y=NzG9pMvImbY6{;yrkV;|lpnbz)Vgk1k#bqZJ<*^7Xdw=XNn8>XX z#N>T};tpXkR`=U*xZ9FF_#)L)nMw2HEP@7}=}n(%_7*!y)0TBh ztmCK%PVD%W^L7y|?+zZ^Kraz_+U0_2Nbb0%u+D zG;WI0?fFudHCk<}d(B88p7bjvN(ITU&C!H*+q!KvgOXD&CF%j17b^mmJDJ2UiI=I^gMEwiek zntAK`vTY>Z6Ts6g#fo4p$vE+`(XxMaRR9-ex4gUcSs&7qLpvGYHCEeS<508yhw+j# zmBCvjS~=7|T~ANS2$aU$1u>}bi$#)=_6M`p`F4IMHhep8GklDJF2p(x_h;dGt&UeN zUkt{I>@31ELc7lNCKSi8%D-%DIRn&4gLS)TZ#AsW=7=N1#n~hikb^0OGwwARV<4|7 z-EM??^ZI^?xiDA=g$-aA`3C%knH(J-%bL3@T*-A~&o(SyR+zuopbiZJ8u2O&^{a#y zYzsUNH=p;1A(MTK=z(0`Yb>ygpGn!mJJGMBQigqmG a>;hBgj$s^Rv{m*VEC2?5&bracFZF-@0!<_U literal 0 HcmV?d00001 diff --git a/Art/reg_shield.png.import b/Art/reg_shield.png.import new file mode 100644 index 0000000..78cabd4 --- /dev/null +++ b/Art/reg_shield.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://3agkku8rqvmj" +path="res://.godot/imported/reg_shield.png-707495a71352fd3f05b6fd7cddacd9a5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/reg_shield.png" +dest_files=["res://.godot/imported/reg_shield.png-707495a71352fd3f05b6fd7cddacd9a5.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/Gameplay/Action.cs b/Gameplay/Action.cs new file mode 100644 index 0000000..b40c714 --- /dev/null +++ b/Gameplay/Action.cs @@ -0,0 +1,12 @@ +using Godot; +using System; + +public partial class Action : Node +{ + public float _timerSeconds, _cooldownSeconds; + public Actor _owner; + public virtual void Fire() + { + + } +} diff --git a/Gameplay/Action.cs.uid b/Gameplay/Action.cs.uid new file mode 100644 index 0000000..362af40 --- /dev/null +++ b/Gameplay/Action.cs.uid @@ -0,0 +1 @@ +uid://cac8dbhhcrjfe diff --git a/Gameplay/Actions/Example1.cs b/Gameplay/Actions/Example1.cs new file mode 100644 index 0000000..bbc1beb --- /dev/null +++ b/Gameplay/Actions/Example1.cs @@ -0,0 +1,25 @@ +using Godot; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; + +public partial class Example1 : Action +{ + + public override void _Ready() + { + base._Ready(); + } + + public override void Fire() + { + base.Fire(); + // GD.Print(_owner); + List unbrokenShields = [.. _owner._board._shields.Where(s=>!s._broken)]; + int shieldNumber = Globals._rng.Next(0, unbrokenShields.Count); + int damageAmount = Globals._rng.Next(-12,-8); + _owner._board._shields[shieldNumber].ChangeHealth(damageAmount); + ((Player)_owner)._phone._debug.Text = "Shield " + shieldNumber + " damaged " + damageAmount + "hp"; + } +} diff --git a/Gameplay/Actions/Example1.cs.uid b/Gameplay/Actions/Example1.cs.uid new file mode 100644 index 0000000..897d0b9 --- /dev/null +++ b/Gameplay/Actions/Example1.cs.uid @@ -0,0 +1 @@ +uid://bgl77ljlxm6xf diff --git a/Gameplay/Actor.cs b/Gameplay/Actor.cs index 61df053..c46c958 100644 --- a/Gameplay/Actor.cs +++ b/Gameplay/Actor.cs @@ -17,204 +17,5 @@ public partial class Actor : Sprite2D _markDisabled = GetNode("MarkDisabled"); _markFocused = GetNode("MarkFocused"); } - - // CALLABLE ACTIONS - - public bool RotateCells(int ROTATIONS = 1) - { - List positions = new(_board._cells.Select(c=>c.Position).ToList()); - List addresses = new(_board._cells.Select(c=>c._address).ToList()); - Dictionary cwShifts = new() - { - {0,1}, {1,2}, {2,5}, {3,0}, {4,4}, {5,8}, {6,3}, {7,6}, {8,7} - }; - Dictionary ccwShifts = new() - { - {0,3}, {1,0}, {2,1}, {3,6}, {4,4}, {5,2}, {6,7}, {7,8}, {8,5} - }; - Dictionary shifts = ROTATIONS > 0 ? cwShifts : ccwShifts; - - for (int i = 0; i < Math.Abs(ROTATIONS); i++) - { - for (int j = 0; j < addresses.Count; j++) - { - int address = addresses[j]; - int newAddress = shifts[address]; - addresses[j] = newAddress; - } - } - - for (int i = 0; i < _board._cells.Count; i++) - { - int newCellAddress = addresses[i]; - _board._cells[i].Position = positions[newCellAddress]; - } - - _board.RenumberCells(); - return true; - } - - public bool RotateMarks(int ROTATIONS = 1) - { - List cells = new(_board._cells); - List addresses = new(_board._cells.Select(c=>c._address).ToList()); - Dictionary cwShifts = new() - { - {0,1}, {1,2}, {2,5}, {3,0}, {4,4}, {5,8}, {6,3}, {7,6}, {8,7} - }; - Dictionary ccwShifts = new() - { - {0,3}, {1,0}, {2,1}, {3,6}, {4,4}, {5,2}, {6,7}, {7,8}, {8,5} - }; - Dictionary shifts = ROTATIONS > 0 ? cwShifts : ccwShifts; - - for (int i = 0; i < Math.Abs(ROTATIONS); i++) - { - for (int j = 0; j < addresses.Count; j++) - { - int address = addresses[j]; - int newAddress = shifts[address]; - addresses[j] = newAddress; - } - } - - for (int i = 0; i < _board._cells.Count; i++) - { - int newCellAddress = addresses[i]; - _board._cells[i].Mark(cells[newCellAddress]._marker); - } - - return true; - } - - public bool ShuffleCells() - { - List positions = new(_board._cells.Select(c=>c.Position).ToList()); - Globals.Shuffle(positions); - for (int i = 0; i < _board._cells.Count; i++) - { - _board._cells[i].Position = positions[i]; - } - _board.RenumberCells(); - return true; - } - - public bool ShuffleMarks() - { - List cells = new(_board._cells); - Globals.Shuffle(cells); - for (int i = 0; i < _board._cells.Count; i++) - { - _board._cells[i].Mark(cells[i]._marker); - } - - return true; - } - - public bool ShiftCells(int SHIFT_ROWS_BY = 0,int SHIFT_COLUMNS_BY = 0) - { - List positions = new(_board._cells.Select(c=>c.Position).ToList()); - int[,] addressTable = {{0,1,2},{3,4,5},{6,7,8}}; - List rows = new(){0,1,2}; - List columns = new(){0,1,2}; - - rows = Globals.ShiftList(rows, SHIFT_ROWS_BY); - columns = Globals.ShiftList(columns, SHIFT_COLUMNS_BY); - - for (int i = 0; i < rows.Count; i++) - { - for (int j = 0; j < columns.Count; j++) - { - _board._cells[addressTable[rows[i],columns[j]]].Position = positions[addressTable[i,j]]; - } - - } - - return true; - } - - public bool ShiftMarks(int SHIFT_ROWS_BY = 0,int SHIFT_COLUMNS_BY = 0) - { - List markers = new(_board._cells.Select(c=>c._marker).ToList()); - int[,] addressTable = {{0,1,2},{3,4,5},{6,7,8}}; - List rows = new(){0,1,2}; - List columns = new(){0,1,2}; - - rows = Globals.ShiftList(rows, SHIFT_ROWS_BY); - columns = Globals.ShiftList(columns, SHIFT_COLUMNS_BY); - - for (int i = 0; i < rows.Count; i++) - { - for (int j = 0; j < columns.Count; j++) - { - _board._cells[addressTable[rows[i],columns[j]]].Mark(markers[addressTable[i,j]]); - } - - } - - return true; - } - - - public bool SlideCells(int SHIFT_SPOTS = 1) - { - List positions = new(_board._cells.Select(c=>c.Position).ToList()); - int start = SHIFT_SPOTS > 0 ? 0 : 9; - for (int i = 0; i < _board._cells.Count; i++) - { - int newSpot = (start + i + SHIFT_SPOTS) % 9; - _board._cells[i].Position = positions[newSpot]; - } - _board.RenumberCells(); - return true; - } - - public bool SlideMarks(int SHIFT_SPOTS = 1) - { - List positions = new(_board._cells.Select(c=>c.Position).ToList()); - int start = SHIFT_SPOTS > 0 ? 0 : 9; - for (int i = 0; i < _board._cells.Count; i++) - { - int newSpot = (start + i + SHIFT_SPOTS) % 9; - _board._cells[i].Position = positions[newSpot]; - } - _board.RenumberCells(); - return true; - } - - public bool SwapCells(int CELL_A_ADDRESS = -1, int CELL_B_ADDRESS = -1) - { - if (CELL_A_ADDRESS < -1 || CELL_A_ADDRESS > 8 || CELL_B_ADDRESS < -1 || CELL_B_ADDRESS > 8 || CELL_A_ADDRESS == CELL_B_ADDRESS) - { - return false; - } - List positions = new(_board._cells.Select(c=>c.Position).ToList()); - if (CELL_A_ADDRESS == -1) - { - CELL_A_ADDRESS = Globals._rng.Next(0,8); - while (CELL_A_ADDRESS == CELL_B_ADDRESS) - { - CELL_A_ADDRESS = Globals._rng.Next(0,8); - } - } - if (CELL_B_ADDRESS == -1) - { - CELL_B_ADDRESS = Globals._rng.Next(0,8); - while (CELL_B_ADDRESS == CELL_A_ADDRESS) - { - CELL_B_ADDRESS = Globals._rng.Next(0,8); - } - } - _board._cells[CELL_A_ADDRESS].Position = positions[CELL_B_ADDRESS]; - _board._cells[CELL_B_ADDRESS].Position = positions[CELL_A_ADDRESS]; - _board.RenumberCells(); - - return true; - } - - - //MoveMark - - } diff --git a/Gameplay/Board.cs b/Gameplay/Board.cs index 4932f6f..ad34f3e 100644 --- a/Gameplay/Board.cs +++ b/Gameplay/Board.cs @@ -2,22 +2,33 @@ using Godot; using System; using System.Collections.Generic; using System.Diagnostics; +using System.Drawing; using System.Linq; using System.Runtime.Serialization; public partial class Board : Sprite2D { public bool _active = false, _moveMade = false, _won = false; - public List _cells = new(); + public List _shields = new(); public Enemy _owner; public Actor _winner = null; public GoalName _winningPattern; public override void _Ready() { - _cells = GetChildren().Where(c=>c is Cell).Cast().ToList(); - for (int i = 0; i < _cells.Count; i++) + _shields = GetChildren().Where(c=>c is Shield).Cast().ToList(); + int xSize = (int)Texture.GetSize().X; + int ySize = (int)Texture.GetSize().Y; + for (int i = 0; i < _shields.Count; i++) { - _cells[i]._address = i; + _shields[i]._address = i; + float shieldX = _shields[i].TextureNormal.GetSize().X; + float shieldY = _shields[i].TextureNormal.GetSize().Y; + + _shields[i].Scale = new Vector2(shieldX / (xSize/3), shieldY / (ySize/3)); + int c = i % 3 - 1; + int r = (int)(i/3) - 1; + + _shields[i].Position = new Vector2(xSize / 3f * c - shieldX / 2, ySize / 3f * r - shieldY / 2); } } @@ -45,14 +56,14 @@ public partial class Board : Sprite2D public void ClaimOwnership(Enemy OWNER) { _owner = OWNER; - _cells.ForEach(c=>c._owner = OWNER); - _cells.ForEach(c=>c._board = this); + _shields.ForEach(c=>c._owner = OWNER); + _shields.ForEach(c=>c._board = this); } public void ClearBoard(){ - foreach (Cell cell in _cells) + foreach (Shield shield in _shields) { - cell.Mark(); + // shield.Mark(); } } @@ -61,19 +72,19 @@ public partial class Board : Sprite2D Disable(true); } - public Cell GetCellByTenant(Enemy TENANT) + public Shield GetShieldByTenant(Enemy TENANT) { - return _cells.Single(c=>c._tenant == TENANT); + return _shields.Single(c=>c._tenant == TENANT); } - public Cell GetCellByAddress(int ADDRESS) + public Shield GetShieldByAddress(int ADDRESS) { - return _cells.Single(c=>c._address == ADDRESS); + return _shields.Single(c=>c._address == ADDRESS); } - public List GetCellsByOwner(Actor ACTOR) + public List GetShieldsByOwner(Actor ACTOR) { - return _cells.Where(c=>c._marker == ACTOR).ToList(); + return _shields.Where(c=>c._marker == ACTOR).ToList(); } //THIS SHOULD BE MOVED INTO ACTION LOGIC @@ -82,17 +93,17 @@ public partial class Board : Sprite2D // for (int i = 0; i < REPEAT; i++) // { // Rotation += DEGREES * ((float)Math.PI / 180); - // RenumberCells(); + // RenumberShields(); // } // } - public void RenumberCells() + public void RenumberShields() { - _cells = _cells.OrderBy(c => c.Position.Y).ThenBy(c => c.Position.X).ToList(); + _shields = _shields.OrderBy(c => c.Position.Y).ThenBy(c => c.Position.X).ToList(); - for (int i = 0; i < _cells.Count; i++) + for (int i = 0; i < _shields.Count; i++) { - _cells[i]._address = i; + _shields[i]._address = i; } } @@ -108,6 +119,6 @@ public partial class Board : Sprite2D _active = !DISABLED; Visible = !DISABLED; SetProcess(!DISABLED); - _cells.ForEach(c=>c.Disable(DISABLED)); + _shields.ForEach(c=>c.Disable(DISABLED)); } } diff --git a/Gameplay/Boss.cs b/Gameplay/Boss.cs index 237ae7c..a9415cd 100644 --- a/Gameplay/Boss.cs +++ b/Gameplay/Boss.cs @@ -15,8 +15,8 @@ public partial class Boss : Enemy for (int i = 0; i < _dragons.Count; i++) { _dragons[i]._owner = this; - _dragons[i]._number = _board._cells[i]._address; - _board._cells[i]._tenant = _dragons[i]; + _dragons[i]._number = _board._shields[i]._address; + _board._shields[i]._tenant = _dragons[i]; } } @@ -26,9 +26,9 @@ public partial class Boss : Enemy _dragons.ForEach(d=>d.PassPlayer(PLAYER)); } - public override void ClickCell(Cell CLICKED_CELL) + public override void ClickShield(Shield CLICKED_SHIELD) { - _playerOpponent.Challenge(CLICKED_CELL._tenant); + _playerOpponent.Challenge(CLICKED_SHIELD._tenant); } } diff --git a/Gameplay/BusinessCard.cs b/Gameplay/BusinessCard.cs index 1861f14..471589e 100644 --- a/Gameplay/BusinessCard.cs +++ b/Gameplay/BusinessCard.cs @@ -40,12 +40,11 @@ public partial class BusinessCard : TextureButton public void CheckGoal() { - List ownedCells = _player._board.GetCellsByOwner(_player); + List ownedShields = _player._board.GetShieldsByOwner(_player); List addresses = _goal.GetAddresses(_goalName); - _goalMet = addresses.All(a=>ownedCells.Select(c=>c._address).ToList().IndexOf(a)>-1); + _goalMet = addresses.All(a=>ownedShields.Select(c=>c._address).ToList().IndexOf(a)>-1); if (_goalMet) { - GD.Print(_goalName); Modulate = new Color(1,1,1,1); } else diff --git a/Gameplay/CallButton.cs b/Gameplay/CallButton.cs index 2abbe44..0cf4a21 100644 --- a/Gameplay/CallButton.cs +++ b/Gameplay/CallButton.cs @@ -14,6 +14,6 @@ public partial class CallButton : TextureButton public override void _Pressed() { base._Pressed(); - _phone.CallLoadedContact(); + _phone._player.StartBattle(); } } diff --git a/Gameplay/Cell.cs b/Gameplay/Cell.cs deleted file mode 100644 index 1a06adb..0000000 --- a/Gameplay/Cell.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Godot; -using System; -using System.Diagnostics; -using System.Runtime.CompilerServices; - -public partial class Cell : TextureButton -{ - public bool _isHovered = false, _isPressed = false, _isDisabled = false, _isFocused = false, _locked = false, _destroyed = false; - public int _address; - public Enemy _owner, _tenant; - public Actor _marker; - public Sprite2D _defaultMark; - public Board _board; - - public override void _Ready() - { - _defaultMark = GetNode("DefaultMark"); - } - - public override void _Pressed() - { - base._Pressed(); - _owner.ClickCell(this); - } - - public override void _Process(double DELTA) - { - base._Process(DELTA); - } - - public void Disable(bool DISABLED) - { - SetProcess(!DISABLED); - } - - public void Mark(Actor MARKER = null) - { - _marker = MARKER; - TextureNormal = (MARKER == null ? _defaultMark : MARKER._markNormal).Texture; - TexturePressed = (MARKER == null ? _defaultMark : MARKER._markPressed).Texture; - TextureHover = (MARKER == null ? _defaultMark : MARKER._markHovered).Texture; - TextureDisabled = (MARKER == null ? _defaultMark : MARKER._markDisabled).Texture; - TextureFocused = (MARKER == null ? _defaultMark : MARKER._markFocused).Texture; - } - -} diff --git a/Gameplay/Contact.cs b/Gameplay/Contact.cs index 072407f..5a26a19 100644 --- a/Gameplay/Contact.cs +++ b/Gameplay/Contact.cs @@ -1,27 +1,73 @@ using Godot; using System; +using System.Runtime.CompilerServices; public partial class Contact : Sprite2D { - public Player _player; - public int _number; + public bool _clickable, _interval; + public int _number, _calls = 0, _maxCalls = 0; + public Timer _timer, _cooldown; + public Action _action; + public Actor _owner; public override void _Ready() { - + _timer = GetNode("Timer"); + _cooldown = GetNode("Cooldown"); + _action = GetNode("Action"); } public virtual void CallAction() { - + if (_cooldown.TimeLeft > 0 || _action._cooldownSeconds == 0) + { + GD.Print("Action fired!!"); + _action.Fire(); + } } public void PassNumber(int NUMBER) { _number = NUMBER; } - public void PassPlayer(Player PLAYER) + public void PassOwner(Actor OWNER) { - _player = PLAYER; + _owner = OWNER; + _action._owner = OWNER; + } + + public void SetTimer(float SECONDS) + { + _action._timerSeconds = SECONDS; + } + + public void SetCooldown(int SECONDS) + { + _action._cooldownSeconds = SECONDS; + } + + public void Start() + { + // GD.Print(_action._timerSeconds); + if (_action._timerSeconds > 0) + { + _timer.Start(_action._timerSeconds); + _calls = 0; + } + } + + private void OnTimerTimeout() + { + if (_calls <= _maxCalls || _maxCalls == 0) + { + CallAction(); + _timer.Start(_action._timerSeconds); + _calls++; + } + } + + private void OnCooldownTimeout() + { + } } diff --git a/Gameplay/Contacts/Rotate90.cs b/Gameplay/Contacts/Rotate90.cs deleted file mode 100644 index 61cf504..0000000 --- a/Gameplay/Contacts/Rotate90.cs +++ /dev/null @@ -1,7 +0,0 @@ -public partial class Rotate90 : Contact -{ - public override void CallAction() - { - _player.RotateCells(2); - } -} \ No newline at end of file diff --git a/Gameplay/Contacts/Rotate90.cs.uid b/Gameplay/Contacts/Rotate90.cs.uid deleted file mode 100644 index 7eb66ed..0000000 --- a/Gameplay/Contacts/Rotate90.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dtv3bqpuf0y33 diff --git a/Gameplay/Contacts/Shift1ColumnRight.cs b/Gameplay/Contacts/Shift1ColumnRight.cs deleted file mode 100644 index 2d86ab1..0000000 --- a/Gameplay/Contacts/Shift1ColumnRight.cs +++ /dev/null @@ -1,7 +0,0 @@ -public partial class Shift1ColumnRight : Contact -{ - public override void CallAction() - { - _player.ShiftCells(0,1); - } -} \ No newline at end of file diff --git a/Gameplay/Contacts/Shift1ColumnRight.cs.uid b/Gameplay/Contacts/Shift1ColumnRight.cs.uid deleted file mode 100644 index 3dc26da..0000000 --- a/Gameplay/Contacts/Shift1ColumnRight.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://ciphg323a14cs diff --git a/Gameplay/Contacts/ShuffleCells.cs b/Gameplay/Contacts/ShuffleCells.cs deleted file mode 100644 index 0be9c1b..0000000 --- a/Gameplay/Contacts/ShuffleCells.cs +++ /dev/null @@ -1,7 +0,0 @@ -public partial class ShuffleCells : Contact -{ - public override void CallAction() - { - _player.ShuffleCells(); - } -} \ No newline at end of file diff --git a/Gameplay/Contacts/ShuffleCells.cs.uid b/Gameplay/Contacts/ShuffleCells.cs.uid deleted file mode 100644 index 4558425..0000000 --- a/Gameplay/Contacts/ShuffleCells.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dshwao6it1ltt diff --git a/Gameplay/Contacts/SlideBack2.cs b/Gameplay/Contacts/SlideBack2.cs deleted file mode 100644 index 4da797d..0000000 --- a/Gameplay/Contacts/SlideBack2.cs +++ /dev/null @@ -1,7 +0,0 @@ -public partial class SlideBack2 : Contact -{ - public override void CallAction() - { - _player.SlideCells(-2); - } -} \ No newline at end of file diff --git a/Gameplay/Contacts/SlideBack2.cs.uid b/Gameplay/Contacts/SlideBack2.cs.uid deleted file mode 100644 index be11010..0000000 --- a/Gameplay/Contacts/SlideBack2.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://c14om0rrrui02 diff --git a/Gameplay/Contacts/Swap1And6.cs b/Gameplay/Contacts/Swap1And6.cs deleted file mode 100644 index 2412c80..0000000 --- a/Gameplay/Contacts/Swap1And6.cs +++ /dev/null @@ -1,7 +0,0 @@ -public partial class Swap1And6 : Contact -{ - public override void CallAction() - { - _player.SwapCells(1-1,6-1); - } -} \ No newline at end of file diff --git a/Gameplay/Contacts/Swap1And6.cs.uid b/Gameplay/Contacts/Swap1And6.cs.uid deleted file mode 100644 index d3d3d24..0000000 --- a/Gameplay/Contacts/Swap1And6.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bl37rkfpucd5e diff --git a/Gameplay/Dragon.cs b/Gameplay/Dragon.cs index b10611f..7125f9a 100644 --- a/Gameplay/Dragon.cs +++ b/Gameplay/Dragon.cs @@ -9,7 +9,7 @@ public partial class Dragon : Enemy // public Board _board; public List _mooks; // public Player _playerOpponent; - // public Cell _cell; + // public Shield _shield; public override void _Ready() { @@ -18,8 +18,8 @@ public partial class Dragon : Enemy for (int i = 0; i < _mooks.Count; i++) { _mooks[i]._owner = this; - _mooks[i]._number = _board._cells[i]._address; - _board._cells[i]._tenant = _mooks[i]; + _mooks[i]._number = _board._shields[i]._address; + _board._shields[i]._tenant = _mooks[i]; } } @@ -35,8 +35,8 @@ public partial class Dragon : Enemy } - public override void ClickCell(Cell CLICKED_CELL) + public override void ClickShield(Shield CLICKED_SHIELD) { - _playerOpponent.Challenge(CLICKED_CELL._tenant); + _playerOpponent.Challenge(CLICKED_SHIELD._tenant); } } diff --git a/Gameplay/Enemy.cs b/Gameplay/Enemy.cs index 8e84e3c..bf5e6ae 100644 --- a/Gameplay/Enemy.cs +++ b/Gameplay/Enemy.cs @@ -7,7 +7,7 @@ public partial class Enemy : Actor { public int _number; public Player _playerOpponent; - public Cell _cell; + public Shield _shield; public Enemy _owner; public List _defaultGoals = new(); public List _goals = new(); @@ -36,13 +36,13 @@ public partial class Enemy : Actor public void CheckGoals() { - List ownedCells = _board.GetCellsByOwner(this); + List ownedShields = _board.GetShieldsByOwner(this); Goal goal = new Goal(); for (int i = 0; i < _defaultGoals.Count; i++) { GoalName goalName = _defaultGoals[i]; List addresses = goal.GetAddresses(goalName); - bool goalMet = addresses.All(a=>ownedCells.Select(c=>c._address).ToList().IndexOf(a)>-1); + bool goalMet = addresses.All(a=>ownedShields.Select(c=>c._address).ToList().IndexOf(a)>-1); if (goalMet) { Victory(goalName); @@ -51,7 +51,7 @@ public partial class Enemy : Actor } } - public virtual void ClickCell(Cell CLICKED_CELL) + public virtual void ClickShield(Shield CLICKED_SHIELD) { } @@ -61,7 +61,7 @@ public partial class Enemy : Actor _board._winningPattern = WINNING_PATTERN; if (_owner != null) { - _owner._board.GetCellByTenant(this).Mark(_playerOpponent); + // _owner._board.GetShieldByTenant(this).Mark(_playerOpponent); } else { @@ -74,7 +74,7 @@ public partial class Enemy : Actor _board._winningPattern = WINNING_PATTERN; if (_owner != null) { - _owner._board.GetCellByTenant(this).Mark(this); + _owner._board.GetShieldByTenant(this).Break(); } else { diff --git a/Gameplay/Mook.cs b/Gameplay/Mook.cs index 945b351..6aa70f2 100644 --- a/Gameplay/Mook.cs +++ b/Gameplay/Mook.cs @@ -12,9 +12,9 @@ public partial class Mook : Enemy } - public override void ClickCell(Cell CLICKED_CELL) + public override void ClickShield(Shield CLICKED_SHIELD) { - CLICKED_CELL.Mark(_playerOpponent); + // CLICKED_SHIELD.Mark(_playerOpponent); _playerOpponent.CheckGoals(); } } diff --git a/Gameplay/Phone.cs b/Gameplay/Phone.cs index 2adf6a7..068e433 100644 --- a/Gameplay/Phone.cs +++ b/Gameplay/Phone.cs @@ -21,11 +21,9 @@ public partial class Phone : Sprite2D { _phoneButtons[i]._phone = this; } - _phoneButtons[0]._contact = new SlideBack2(); - _phoneButtons[1]._contact = new Rotate90(); - _phoneButtons[2]._contact = new Swap1And6(); - _phoneButtons[3]._contact = new Shift1ColumnRight(); - _phoneButtons[4]._contact = new ShuffleCells(); + _phoneButtons[0]._contact._action = new Example1(); + _phoneButtons[0]._contact._action._owner = _player; + _phoneButtons[0]._contact.SetTimer(1.5f); } public override void _Process(double DELTA_) @@ -33,17 +31,17 @@ public partial class Phone : Sprite2D // _hoveredButton = _phoneButtons.FirstOrDefault(c => c._isHovered, null); } - public void CallLoadedContact() - { - _loadedContact.CallAction(); - ResetContact(); - } + // public void CallLoadedContact() + // { + // _loadedContact.CallAction(); + // ResetContact(); + // } - public void LoadContact(Contact CONTACT) - { - _loadedContact = CONTACT; - _debug.Text = _loadedContact.GetType().ToString(); - } + // public void LoadContact(Contact CONTACT) + // { + // _loadedContact = CONTACT; + // _debug.Text = _loadedContact.GetType().ToString(); + // } public void PassPlayer(Player PLAYER) { @@ -51,7 +49,7 @@ public partial class Phone : Sprite2D for (int i = 0; i < _phoneButtons.Count; i++) { _phoneButtons[i]._phone = this; - _phoneButtons[i]._contact.PassPlayer(PLAYER); + _phoneButtons[i]._contact.PassOwner(PLAYER); _phoneButtons[i]._contact.PassNumber((i+1)%10); } } diff --git a/Gameplay/PhoneButton.cs b/Gameplay/PhoneButton.cs index 2b1667a..3ace364 100644 --- a/Gameplay/PhoneButton.cs +++ b/Gameplay/PhoneButton.cs @@ -4,7 +4,7 @@ using System; public partial class PhoneButton : TextureButton { // [Signal] - // public delegate void HoverEventHandler(Cell THISCELL, bool ISHOVERED); + // public delegate void HoverEventHandler(Shield THISSHIELD, bool ISHOVERED); public bool _isHovered = false; public Phone _phone; public Contact _contact; @@ -18,7 +18,10 @@ public partial class PhoneButton : TextureButton public override void _Pressed() { base._Pressed(); - _phone.LoadContact(_contact); + if (_contact._clickable) + { + _contact.CallAction(); + } } diff --git a/Gameplay/Player.cs b/Gameplay/Player.cs index 5c3e9a1..c72760b 100644 --- a/Gameplay/Player.cs +++ b/Gameplay/Player.cs @@ -82,13 +82,21 @@ public partial class Player : Actor _debug.Text = "YOU WIN!!"; } - // public bool CheckWin(List CELLS) + public void StartBattle() + { + for (int i = 0; i < _phone._phoneButtons.Count; i++) + { + _phone._phoneButtons[i]._contact.Start(); + } + } + + // public bool CheckWin(List SHIELDS) // { // foreach (Goal.GoalName cond in _goal._eligibleGoals) // { // foreach (List condList in _goal._conditions[cond]) // { - // // if (condList.All(a=>CELLS.FirstOrDefault(c=>c._address == a, null)?._owner == this)) + // // if (condList.All(a=>SHIELDS.FirstOrDefault(c=>c._address == a, null)?._owner == this)) // // { // // return true; // // } @@ -96,10 +104,10 @@ public partial class Player : Actor // } // return false; // } - // public void MarkCell(Cell CELL) + // public void MarkShield(Shield SHIELD) // { - // CELL._mark.Texture = _mark.Texture; - // // CELL._owner = this; + // SHIELD._mark.Texture = _mark.Texture; + // // SHIELD._owner = this; // } public override void _Process(double delta) diff --git a/Gameplay/Shield.cs b/Gameplay/Shield.cs new file mode 100644 index 0000000..a630750 --- /dev/null +++ b/Gameplay/Shield.cs @@ -0,0 +1,66 @@ +using Godot; +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +public partial class Shield : TextureButton +{ + public bool _isHovered = false, _isPressed = false, _isDisabled = false, _isFocused = false, _locked = false, _destroyed = false, _broken = false; + public int _address, _durability; + public Enemy _owner, _tenant; + public Actor _marker; + public Sprite2D _regularMark, _brokenMark; + public Board _board; + + public override void _Ready() + { + _regularMark = GetNode("RegularMark"); + _brokenMark = GetNode("BrokenMark"); + _durability = 100; + } + + public override void _Pressed() + { + base._Pressed(); + _owner.ClickShield(this); + } + + public override void _Process(double DELTA) + { + base._Process(DELTA); + } + + public void Break() + { + _broken = true; + TextureNormal = TexturePressed = TextureHover = TextureDisabled = TextureFocused = _brokenMark.Texture; + } + + public void ChangeHealth(int CHANGE_AMOUNT) + { + _durability += CHANGE_AMOUNT; + if (!_broken) + { + if (_durability <= 0) + { + Break(); + } + } + } + + public void Disable(bool DISABLED) + { + SetProcess(!DISABLED); + } + + // public void Mark(Actor MARKER = null) + // { + // _marker = MARKER; + // TextureNormal = (MARKER == null ? _defaultMark : MARKER._markNormal).Texture; + // TexturePressed = (MARKER == null ? _defaultMark : MARKER._markPressed).Texture; + // TextureHover = (MARKER == null ? _defaultMark : MARKER._markHovered).Texture; + // TextureDisabled = (MARKER == null ? _defaultMark : MARKER._markDisabled).Texture; + // TextureFocused = (MARKER == null ? _defaultMark : MARKER._markFocused).Texture; + // } + +} diff --git a/Gameplay/Cell.cs.uid b/Gameplay/Shield.cs.uid similarity index 100% rename from Gameplay/Cell.cs.uid rename to Gameplay/Shield.cs.uid diff --git a/Gameplay/action.tscn b/Gameplay/action.tscn new file mode 100644 index 0000000..9cfa99c --- /dev/null +++ b/Gameplay/action.tscn @@ -0,0 +1,6 @@ +[gd_scene format=3 uid="uid://fygidhjkgabe"] + +[ext_resource type="Script" uid="uid://cac8dbhhcrjfe" path="res://Gameplay/Action.cs" id="1_lk435"] + +[node name="Action" type="Node" unique_id=110922950] +script = ExtResource("1_lk435") diff --git a/Gameplay/board.tscn b/Gameplay/board.tscn index f599c32..f678cfd 100644 --- a/Gameplay/board.tscn +++ b/Gameplay/board.tscn @@ -1,63 +1,27 @@ -[gd_scene load_steps=4 format=3 uid="uid://jkmo1fb2ohv4"] +[gd_scene format=3 uid="uid://jkmo1fb2ohv4"] [ext_resource type="Texture2D" uid="uid://cbi83mc26qju5" path="res://Art/Tic-tac-toe.png" id="1_iqk8r"] [ext_resource type="Script" uid="uid://decakbqo4jfdi" path="res://Gameplay/Board.cs" id="2_ucn0m"] -[ext_resource type="PackedScene" uid="uid://0vj01cjcpibt" path="res://Gameplay/cell.tscn" id="3_s74v7"] +[ext_resource type="PackedScene" uid="uid://b32djog2mowgw" path="res://Gameplay/shield.tscn" id="3_ucn0m"] -[node name="Board" type="Sprite2D"] +[node name="Board" type="Sprite2D" unique_id=816918439] texture = ExtResource("1_iqk8r") script = ExtResource("2_ucn0m") -[node name="Cell1" parent="." instance=ExtResource("3_s74v7")] -offset_left = -300.0 -offset_top = -301.0 -offset_right = -100.0 -offset_bottom = -101.0 +[node name="Shield0" parent="." unique_id=1408990258 instance=ExtResource("3_ucn0m")] -[node name="Cell2" parent="." instance=ExtResource("3_s74v7")] -offset_left = -100.0 -offset_top = -300.0 -offset_right = 100.0 -offset_bottom = -100.0 +[node name="Shield1" parent="." unique_id=1099937150 instance=ExtResource("3_ucn0m")] -[node name="Cell3" parent="." instance=ExtResource("3_s74v7")] -offset_left = 100.0 -offset_top = -300.0 -offset_right = 300.0 -offset_bottom = -100.0 +[node name="Shield2" parent="." unique_id=555260924 instance=ExtResource("3_ucn0m")] -[node name="Cell4" parent="." instance=ExtResource("3_s74v7")] -offset_left = -300.0 -offset_top = -100.0 -offset_right = -100.0 -offset_bottom = 100.0 +[node name="Shield3" parent="." unique_id=1428089072 instance=ExtResource("3_ucn0m")] -[node name="Cell5" parent="." instance=ExtResource("3_s74v7")] -offset_left = -100.0 -offset_top = -100.0 -offset_right = 100.0 -offset_bottom = 100.0 +[node name="Shield4" parent="." unique_id=1268807490 instance=ExtResource("3_ucn0m")] -[node name="Cell6" parent="." instance=ExtResource("3_s74v7")] -offset_left = 100.0 -offset_top = -100.0 -offset_right = 300.0 -offset_bottom = 100.0 +[node name="Shield5" parent="." unique_id=646412611 instance=ExtResource("3_ucn0m")] -[node name="Cell7" parent="." instance=ExtResource("3_s74v7")] -offset_left = -300.0 -offset_top = 100.0 -offset_right = -100.0 -offset_bottom = 300.0 +[node name="Shield6" parent="." unique_id=1387360377 instance=ExtResource("3_ucn0m")] -[node name="Cell8" parent="." instance=ExtResource("3_s74v7")] -offset_left = -100.0 -offset_top = 100.0 -offset_right = 100.0 -offset_bottom = 300.0 +[node name="Shield7" parent="." unique_id=949001958 instance=ExtResource("3_ucn0m")] -[node name="Cell9" parent="." instance=ExtResource("3_s74v7")] -offset_left = 100.0 -offset_top = 100.0 -offset_right = 300.0 -offset_bottom = 300.0 +[node name="Shield8" parent="." unique_id=1837156402 instance=ExtResource("3_ucn0m")] diff --git a/Gameplay/cell.tscn b/Gameplay/cell.tscn deleted file mode 100644 index d0e0b4d..0000000 --- a/Gameplay/cell.tscn +++ /dev/null @@ -1,19 +0,0 @@ -[gd_scene format=3 uid="uid://0vj01cjcpibt"] - -[ext_resource type="Script" uid="uid://pg7mpir3ewhw" path="res://Gameplay/Cell.cs" id="1_lehgd"] -[ext_resource type="Texture2D" uid="uid://g6ikqlh8yccy" path="res://Art/blanksquare.jpg" id="2_mxyjk"] - -[node name="Cell" type="TextureButton" unique_id=1408990258] -modulate = Color(1, 1, 1, 0.2) -offset_right = 200.0 -offset_bottom = 200.0 -texture_normal = ExtResource("2_mxyjk") -texture_pressed = ExtResource("2_mxyjk") -texture_hover = ExtResource("2_mxyjk") -texture_disabled = ExtResource("2_mxyjk") -texture_focused = ExtResource("2_mxyjk") -script = ExtResource("1_lehgd") - -[node name="DefaultMark" type="Sprite2D" parent="." unique_id=1684344431] -visible = false -texture = ExtResource("2_mxyjk") diff --git a/Gameplay/contact.tscn b/Gameplay/contact.tscn index 1a29102..2da0020 100644 --- a/Gameplay/contact.tscn +++ b/Gameplay/contact.tscn @@ -1,6 +1,16 @@ -[gd_scene load_steps=2 format=3 uid="uid://if21pf73w7by"] +[gd_scene format=3 uid="uid://if21pf73w7by"] [ext_resource type="Script" uid="uid://bgj2cuqdq0b6l" path="res://Gameplay/Contact.cs" id="1_basqx"] +[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/action.tscn" id="2_dg7ct"] -[node name="Contact" type="Sprite2D"] +[node name="Contact" type="Sprite2D" unique_id=1143036413] script = ExtResource("1_basqx") + +[node name="Timer" type="Timer" parent="." unique_id=879173975] + +[node name="Cooldown" type="Timer" parent="." unique_id=1276257080] + +[node name="Action" parent="." unique_id=110922950 instance=ExtResource("2_dg7ct")] + +[connection signal="timeout" from="Timer" to="." method="OnTimerTimeout"] +[connection signal="timeout" from="Cooldown" to="." method="OnCooldownTimeout"] diff --git a/Gameplay/shield.tscn b/Gameplay/shield.tscn new file mode 100644 index 0000000..cd5c43e --- /dev/null +++ b/Gameplay/shield.tscn @@ -0,0 +1,24 @@ +[gd_scene format=3 uid="uid://b32djog2mowgw"] + +[ext_resource type="Texture2D" uid="uid://3agkku8rqvmj" path="res://Art/reg_shield.png" id="1_j8jvf"] +[ext_resource type="Script" uid="uid://pg7mpir3ewhw" path="res://Gameplay/Shield.cs" id="2_53x4r"] +[ext_resource type="Texture2D" uid="uid://b5oc4f3gxijq5" path="res://Art/broken_shield.png" id="3_tgx6c"] + +[node name="Shield" type="TextureButton" unique_id=1408990258] +modulate = Color(1, 1, 1, 0.2) +offset_right = 200.0 +offset_bottom = 200.0 +texture_normal = ExtResource("1_j8jvf") +texture_pressed = ExtResource("1_j8jvf") +texture_hover = ExtResource("1_j8jvf") +texture_disabled = ExtResource("1_j8jvf") +texture_focused = ExtResource("1_j8jvf") +script = ExtResource("2_53x4r") + +[node name="RegularMark" type="Sprite2D" parent="." unique_id=1684344431] +visible = false +texture = ExtResource("1_j8jvf") + +[node name="BrokenMark" type="Sprite2D" parent="." unique_id=1605725110] +visible = false +texture = ExtResource("3_tgx6c")