Skip to content

Commit

Permalink
Merge pull request #303 from Teicsoft/ModifierIcons
Browse files Browse the repository at this point in the history
Modifier icons for Grappled, Juggled and Grounded
  • Loading branch information
soma-code authored Feb 23, 2024
2 parents ebdc33a + 53d5043 commit 3ab606f
Show file tree
Hide file tree
Showing 11 changed files with 174 additions and 6 deletions.
Binary file added assets/images/ModifierIcons/Grappled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/images/ModifierIcons/Grappled.png.import
Original file line number Diff line number Diff line change
@@ -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
Binary file added assets/images/ModifierIcons/Grounded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/images/ModifierIcons/Grounded.png.import
Original file line number Diff line number Diff line change
@@ -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
Binary file added assets/images/ModifierIcons/Juggled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/images/ModifierIcons/Juggled.png.import
Original file line number Diff line number Diff line change
@@ -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
11 changes: 10 additions & 1 deletion scenes/battle/Battle.tscn
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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"]
Expand Down Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion scenes/battle/Enemy.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[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"]
[ext_resource type="Texture2D" uid="uid://dwbcqbf47gaw5" path="res://assets/ui/Button.png" id="2_mb0el"]
[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"]

Expand Down Expand Up @@ -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"]
17 changes: 16 additions & 1 deletion scripts/battle/Battle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,29 @@ private void InitialiseGameState(List<string> playerCardIds, List<Enemy> enemies
_gameState.AllEnemiesDefeatedCustomEvent += WinBattle;
_gameState.ComboPlayedCustomEvent += DisplayPlayedCombo;
_gameState.Hand.Deck.DeckShuffledCustomEvent += OnDeckShuffled;
_gameState.Player.PlayerModifierChangedCustomEvent += OnPlayerMofifierChanged;


_gameState.Draw(4);
if (sceneLoader.Health != 0) { _gameState.Player.Health = sceneLoader.Health; }
sceneLoader.i += 1;
if (sceneLoader.SpectaclePoints != 0) { _gameState.SpectaclePoints = sceneLoader.SpectaclePoints; }
}


private void OnPlayerMofifierChanged(object sender, EventArgs e)
{
TextureRect PlayerModifierIcon = GetNode<TextureRect>("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<Enemy> CreateEnemies(List<string> enemyIds) {
int idsCount = enemyIds.Count;
List<Enemy> enemies = new();
Expand Down
25 changes: 23 additions & 2 deletions scripts/battle/target/Enemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Card> Deck;
private int _health;
Expand All @@ -28,6 +28,27 @@ public partial class Enemy : Node2D, ITarget {
public int MaxHealth { get; set; }
public HashSet<Utils.StatusEnum> Statuses { get; set; } = new();

public Utils.ModifierEnum Modifier
{
get => _modifier;
set
{
_modifier = value;

TextureRect icon = GetNode<TextureRect>("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 {
Expand Down
13 changes: 12 additions & 1 deletion scripts/battle/target/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Utils.StatusEnum> 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;
Expand Down

0 comments on commit 3ab606f

Please sign in to comment.