From dfdb6da4e70614fbeed49735d81f043da9f38371 Mon Sep 17 00:00:00 2001 From: Emmett Date: Fri, 23 Feb 2024 16:32:16 +0000 Subject: [PATCH 1/2] Added Icons to display Modifiers on enemies. --- assets/images/ModifierIcons/Grappled.png | Bin 0 -> 811 bytes .../images/ModifierIcons/Grappled.png.import | 34 ++++++++++++++++++ assets/images/ModifierIcons/Grounded.png | Bin 0 -> 982 bytes .../images/ModifierIcons/Grounded.png.import | 34 ++++++++++++++++++ assets/images/ModifierIcons/Juggled.png | Bin 0 -> 1207 bytes .../images/ModifierIcons/Juggled.png.import | 34 ++++++++++++++++++ scenes/battle/Enemy.tscn | 12 ++++++- scripts/battle/target/Enemy.cs | 25 +++++++++++-- 8 files changed, 136 insertions(+), 3 deletions(-) create mode 100644 assets/images/ModifierIcons/Grappled.png create mode 100644 assets/images/ModifierIcons/Grappled.png.import create mode 100644 assets/images/ModifierIcons/Grounded.png create mode 100644 assets/images/ModifierIcons/Grounded.png.import create mode 100644 assets/images/ModifierIcons/Juggled.png create mode 100644 assets/images/ModifierIcons/Juggled.png.import diff --git a/assets/images/ModifierIcons/Grappled.png b/assets/images/ModifierIcons/Grappled.png new file mode 100644 index 0000000000000000000000000000000000000000..c0760624c3904e48153ed7c6ffe3ee979bf1d12b GIT binary patch literal 811 zcmV+`1JwM9P)Px%oiuf_=vM4KTLQ_N-_W&77ne@y)U{)$ z{(x@YZ2}D#n+{##p%h};H55#6)ggN7>1s)Lr?V|XKL|L|S$W^RyQjM&&>WKV$BDpW zAkK86IOzu=0H;@%;1Jh6&oMdEZST=-?=kQ7z#%h@5Sh*IYgM8I995kpJo@cJhEY&y&uB_h?UAB5P>nZ^t)wFGzDds$ZG8kCpj zt&6Ava3>*rUjE|MkKaZzTNNpj5KLvZBGQTC1oFdXl?1?Oz94KZD`hq=Vk#jMU8s`T zXw`C+5T>&Ur&pJRttDY=$*1SfAgyK_6R9H+ww4@SjNz{LgY>gXvi6}R0^mhLB}p^F z(Z$$pj;O&2)7c~_YNHB(okSXFQJnHO0%H+1Fm){i`6Y$Q;9x%&U|D6-Q6#{iC{;EP z0X=vdBv6M;7{v(ipy)UB)Rt9~yi8tj$p%=w5PirLRjoQhO0fEpz6~|$VOTw91RoM$xkS;2 zSy?Zu=)&rEZhzjl384_@H@jZRY_p@bcRiF-aauI$nK6}6+nQw3hFZNKnXwVk@sSOv zxr~?0`0ia7YVSuLK6*?OWNL|YqBuGK_?DC7GpF~APn<>NrJ@;N`CLd1iFkULcKEm0bbM+ueeP!0SID=5gw znj}EU%!*^rTKp5#8YNV+6GBhV%V%Um62706f8Yis)#wQ|5E?)#2*s>+q4_8AfEsL002ovPDHLkV1mmWXT$&i literal 0 HcmV?d00001 diff --git a/assets/images/ModifierIcons/Grappled.png.import b/assets/images/ModifierIcons/Grappled.png.import new file mode 100644 index 0000000..5d43dc9 --- /dev/null +++ b/assets/images/ModifierIcons/Grappled.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bf1b4q7nrb1ka" +path="res://.godot/imported/Grappled.png-fad394dcd541ce2f1ce26e9797c39a36.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/ModifierIcons/Grappled.png" +dest_files=["res://.godot/imported/Grappled.png-fad394dcd541ce2f1ce26e9797c39a36.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/images/ModifierIcons/Grounded.png b/assets/images/ModifierIcons/Grounded.png new file mode 100644 index 0000000000000000000000000000000000000000..e4bd628fd8a093c7d2d6b12aff05974f790f79b0 GIT binary patch literal 982 zcmV;{11bE8P)Px&kV!;ARA_4x*Qg8yQ(B=rSl+-9v z3TiHZw7>YCWjvl;&w_2fzW$Rez}{u|?aaK{9RvReCi2E|y>nW_x7Wv3+rJ5Za(Py` z`-hjt!=LwOOlNc4l}|WS8&n@#Ga0@hV=RJ7h;xfav<(*b7- ze0_h?^GTi+?sVKYtP?|?72XnuY6AecE1ysA3eK05rZ2g%A-5zmnETosN5dje)7W5i|dEHV^(0S?N%1T9dCnwt%9LeWFDq;L8nH z3I#4%YdV|LM7E1x>EeJZ#+%fwnP zR;~7CA~9=_$@?ZF!DB*>Wg@~mRUg~NMXNOc8NbJ?1t;pdoqkOdqpiJACkFsL|D@P0CB)cd z8qdfwLyG`kbWeoqwgS_NO34JqQ?y?4NR39kaEw7lB|?%a&J-53f}b!n8Bc`H=E{nu z2I^2`f;)3RsO-@3+&nPwN6A7*03b=x)bmns8;`SgUn`m3GExaI$u(VvzCMFpgI^4d zOoFR*k{y}|!1hd9X~;mvE!R8TKfFYb;A0jDqBVi83TCLDMlo^|B0$*JH9}n^fN@-l zFwruf}!3Ko{syLn^~01JONoS(*iJskXC@>7SUox ziw#1`N~*z0gx+2s&HopxA_8GTF(Ow7`=Q!gL}EId2eZ4Jymr6U$1=DE;mbi1QWz}$ zE`#2ZYc3|jVR@?sq-X4}?@#1e;Xh+YRU7rVX?epHgGQi+d43mLga*sAB5L{&Nv+Q{ z?;n#bqV!eWs>>BPZt()u!Eo$k?bNGQu0acS|8Z;l2G|K;ASNgyrvLx|07*qoM6N<$ Eg7coaPyhe` literal 0 HcmV?d00001 diff --git a/assets/images/ModifierIcons/Grounded.png.import b/assets/images/ModifierIcons/Grounded.png.import new file mode 100644 index 0000000..470a127 --- /dev/null +++ b/assets/images/ModifierIcons/Grounded.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dewdt27iomoqk" +path="res://.godot/imported/Grounded.png-6bf04e661a2ada3a9d663e094c3e1e11.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/ModifierIcons/Grounded.png" +dest_files=["res://.godot/imported/Grounded.png-6bf04e661a2ada3a9d663e094c3e1e11.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/images/ModifierIcons/Juggled.png b/assets/images/ModifierIcons/Juggled.png new file mode 100644 index 0000000000000000000000000000000000000000..22890393c23fa2c82ae823aa64d3b81a1c9e90fe GIT binary patch literal 1207 zcmV;o1W5adP)Px(aY;l$RA_dzy>xK|o2Vq8YO}r_h&6b2B~I-=Gw?U_=i-xWqV#2_ZchBXEofjaN|I2)PIGjGmc&=54jQ>3`A8 z?#%A<+vjCwSHMUk4MiUmeZi%Ll}q24KmYo@@cR~WLDTr{^=HARn#=)Q z#`|Q#<$=l#vb3;r8De~C_BsHddwAv?_wxB|eDm}p)sKZ4ix~`L!^kw0`gDvRx52!8 zep|I$Yttxi9;^F=0!2~N#ciJ8#<~obL>_6aO{-(&&0_#zFs0BN5yT&lTm8wi*EJ7t zbq~+1=R!qLA(b!)#DuT`nBf)U5mWDHuL9`7wAQA*Fy0)IJYmWVqwe9E7WbsP_g?#M zms?H{8${{;nre4`{t-YwVR_}r=;<83|NLL=(A|5lHRyEj4U+1oR(ovuVg<>B6EohF zw8(w^_N~_c;o3C-0;m8703ROyqxGqp*<`H-OA9NP62yaQQ?=*MkHoploy2;>=2(j5 zPJ-rG3II5moYBs|x^+eK$otu=3d&W*L=XpC4iV{3w&W zHW5sS%#bWs)={pkquosulnKFCel9Vz$auQhawqW`w>UMf#>9FA06v~?sCK!s4gk3G z_kRGg6$}vee6|bQ5_o&-RO_cZ?~v}iQ+hyfoJ54GJ$(v`3_*-aWYx zpKM4jNZv3P!`A+W_c}fW?S8p2F>3|jhvn7DCdw0+)H>qYCi8f=oddFvQhsr7w7W?! zgsK%_Z@>TRP%l@qt9$T^Rfv2~UxeV|5Y>umQo_4bC;ZaC+>x^+dh zKl|>5IHqtAK!>3=uTok_k$Bsq=uP7wqDlwIAysSC^-%KU1_0;#hyoeLXG|_BFKUf? zb|87i0P}rO8Jb6&@`VvQ&sTTX!_I)vD``<`j-{CdmsD%iweo8&lD>$^oTT+6bldKd zuiVxeb?p4~YyW@&GEwTyFZ2UlUJ-;O4Fc#dicF!on*pJTgNB$HQklii6a&b!_Yyra zD2%vfgs56U>&aIDpu#Ft*3imZj>!|&ZHOeJ{o@6MjFYk{{f%j VX7*H9T5|vZ002ovPDHLkV1lPKNtOTr literal 0 HcmV?d00001 diff --git a/assets/images/ModifierIcons/Juggled.png.import b/assets/images/ModifierIcons/Juggled.png.import new file mode 100644 index 0000000..e456d04 --- /dev/null +++ b/assets/images/ModifierIcons/Juggled.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://4k1okc7teid6" +path="res://.godot/imported/Juggled.png-14f415e935d762e9725c593127d86fb2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/ModifierIcons/Juggled.png" +dest_files=["res://.godot/imported/Juggled.png-14f415e935d762e9725c593127d86fb2.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/scenes/battle/Enemy.tscn b/scenes/battle/Enemy.tscn index dcae65c..603d523 100644 --- a/scenes/battle/Enemy.tscn +++ b/scenes/battle/Enemy.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://rocmwsrfn6p7"] +[gd_scene load_steps=9 format=3 uid="uid://rocmwsrfn6p7"] [ext_resource type="Script" path="res://scripts/battle/target/Enemy.cs" id="1_nns8m"] [ext_resource type="Texture2D" uid="uid://dugrn574r1n0d" path="res://assets/sprites/Z/loser5.png" id="2_ggci3"] @@ -6,6 +6,7 @@ [ext_resource type="Theme" uid="uid://hajaa20bfn8q" path="res://styles/Bigtext.tres" id="3_df0w2"] [ext_resource type="Texture2D" uid="uid://c2ui510hlcb4m" path="res://assets/ui/Eneemy Healthbar.png" id="4_e4ref"] [ext_resource type="Texture2D" uid="uid://bs6on0sod5l28" path="res://assets/ui/Armor.png" id="6_aa264"] +[ext_resource type="Texture2D" uid="uid://4k1okc7teid6" path="res://assets/images/ModifierIcons/Juggled.png" id="7_3j0ii"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mxw43"] @@ -146,5 +147,14 @@ vertical_alignment = 1 [node name="CardPlayedTimer" type="Timer" parent="."] wait_time = 2.0 +[node name="ModifierIcon" type="TextureRect" parent="."] +visible = false +offset_left = 58.0 +offset_top = -199.0 +offset_right = 98.0 +offset_bottom = -159.0 +texture = ExtResource("7_3j0ii") +expand_mode = 3 + [connection signal="pressed" from="SelectButton" to="." method="OnPress"] [connection signal="timeout" from="CardPlayedTimer" to="." method="OnCardPlayedTimer"] diff --git a/scripts/battle/target/Enemy.cs b/scripts/battle/target/Enemy.cs index c877ce4..eb54f8a 100644 --- a/scripts/battle/target/Enemy.cs +++ b/scripts/battle/target/Enemy.cs @@ -18,8 +18,8 @@ public partial class Enemy : Node2D, ITarget { public string SoundEffect { get; set; } public string Lore { get; set; } public string DeckId { get; set; } - - public Utils.ModifierEnum Modifier { get; set; } = Utils.ModifierEnum.None; + private Utils.ModifierEnum _modifier = Utils.ModifierEnum.None; + public Color Color; public Deck Deck; private int _health; @@ -28,6 +28,27 @@ public partial class Enemy : Node2D, ITarget { public int MaxHealth { get; set; } public HashSet Statuses { get; set; } = new(); + public Utils.ModifierEnum Modifier + { + get => _modifier; + set + { + _modifier = value; + + TextureRect icon = GetNode("ModifierIcon"); + if (value == Utils.ModifierEnum.None) + { + icon.Visible = false; + } + else + { + icon.Visible = true; + icon.Texture = (Texture2D)GD.Load($"res://assets/images/ModifierIcons/{_modifier}.png"); + } + + } + } + public int Health { get => _health; set { From 53d504378882f69b9736e60132923af12cc6e03f Mon Sep 17 00:00:00 2001 From: Emmett Date: Fri, 23 Feb 2024 16:57:24 +0000 Subject: [PATCH 2/2] Added PLayer Modifier indicators --- scenes/battle/Battle.tscn | 11 ++++++++++- scripts/battle/Battle.cs | 17 ++++++++++++++++- scripts/battle/target/Player.cs | 13 ++++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/scenes/battle/Battle.tscn b/scenes/battle/Battle.tscn index 367403c..8f8fe0a 100644 --- a/scenes/battle/Battle.tscn +++ b/scenes/battle/Battle.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=26 format=3 uid="uid://7q8qanamfdls"] +[gd_scene load_steps=27 format=3 uid="uid://7q8qanamfdls"] [ext_resource type="Script" path="res://scripts/battle/Battle.cs" id="1_bmdek"] [ext_resource type="PackedScene" uid="uid://rocmwsrfn6p7" path="res://scenes/battle/Enemy.tscn" id="3_25d28"] @@ -17,6 +17,7 @@ [ext_resource type="Texture2D" uid="uid://cb36nakc83n62" path="res://assets/ui/Sound_on.png" id="11_nrxls"] [ext_resource type="Texture2D" uid="uid://djssdn4r1g4f5" path="res://assets/ui/sound_off.png" id="12_8fj8e"] [ext_resource type="Texture2D" uid="uid://di6jj3qkji1wr" path="res://assets/sprites/Emperor_Thumbs/Emperor_Thumb_Down.png" id="12_a85jt"] +[ext_resource type="Texture2D" uid="uid://bf1b4q7nrb1ka" path="res://assets/images/ModifierIcons/Grappled.png" id="13_25d22"] [ext_resource type="PackedScene" uid="uid://87kw3tjkavuh" path="res://scenes/glossary/card_glossary.tscn" id="13_mwfol"] [ext_resource type="PackedScene" uid="uid://vjrk3p65fmid" path="res://scenes/glossary/combo_glossary.tscn" id="14_fhiga"] [ext_resource type="Texture2D" uid="uid://ifvsgnxfw40l" path="res://assets/ui/thicc_border_top_corner.png" id="16_o3gvq"] @@ -295,6 +296,14 @@ rotation = -0.785398 scale = Vector2(4, 4) texture = ExtResource("12_a85jt") +[node name="PlayerModifierIcon" type="TextureRect" parent="HUD"] +visible = false +offset_left = 1391.0 +offset_top = 63.0 +offset_right = 1441.0 +offset_bottom = 113.0 +texture = ExtResource("13_25d22") + [node name="PlayerUpperBlockRect" type="ColorRect" parent="HUD"] visible = false offset_left = 301.0 diff --git a/scripts/battle/Battle.cs b/scripts/battle/Battle.cs index 866156f..1449f1c 100644 --- a/scripts/battle/Battle.cs +++ b/scripts/battle/Battle.cs @@ -74,6 +74,7 @@ private void InitialiseGameState(List playerCardIds, List enemies _gameState.AllEnemiesDefeatedCustomEvent += WinBattle; _gameState.ComboPlayedCustomEvent += DisplayPlayedCombo; _gameState.Hand.Deck.DeckShuffledCustomEvent += OnDeckShuffled; + _gameState.Player.PlayerModifierChangedCustomEvent += OnPlayerMofifierChanged; _gameState.Draw(4); @@ -81,7 +82,21 @@ private void InitialiseGameState(List playerCardIds, List enemies sceneLoader.i += 1; if (sceneLoader.SpectaclePoints != 0) { _gameState.SpectaclePoints = sceneLoader.SpectaclePoints; } } - + + private void OnPlayerMofifierChanged(object sender, EventArgs e) + { + TextureRect PlayerModifierIcon = GetNode("HUD/PlayerModifierIcon"); + if (_gameState.Player.Modifier == Utils.ModifierEnum.None) + { + PlayerModifierIcon.Visible = false; + } + else + { + PlayerModifierIcon.Texture = (Texture2D)GD.Load($"res://assets/images/ModifierIcons/{_gameState.Player.Modifier}.png"); + PlayerModifierIcon.Visible = true; + } + } + private List CreateEnemies(List enemyIds) { int idsCount = enemyIds.Count; List enemies = new(); diff --git a/scripts/battle/target/Player.cs b/scripts/battle/target/Player.cs index 1a9aa06..f830594 100644 --- a/scripts/battle/target/Player.cs +++ b/scripts/battle/target/Player.cs @@ -8,11 +8,22 @@ public partial class Player : Node2D, ITarget { public event EventHandler PlayerHealthChangedCustomEvent; public event EventHandler PlayerDefenseLowerChangedCustomEvent; public event EventHandler PlayerDefenseUpperChangedCustomEvent; + public event EventHandler PlayerModifierChangedCustomEvent; public string Name { get; set; } public int MaxHealth { get; set; } public HashSet Statuses { get; set; } = new(); - public Utils.ModifierEnum Modifier { get; set; } = Utils.ModifierEnum.None; + + private Utils.ModifierEnum _modifier = Utils.ModifierEnum.None; + public Utils.ModifierEnum Modifier + { + get => _modifier; + set { + _modifier = value; + PlayerModifierChangedCustomEvent?.Invoke(this, EventArgs.Empty); + } + } + private int _health; private int _defenseLower = 0; private int _defenseUpper = 1;