Repository: thetawavegame/thetawave-legacy (language: rust)

Issue:
Add item to item pool that increases the total health of the spaceship
Add item to item pool that increases the total health of the player by a reasonable amount.


Discussion / hints:

Fix patch:
diff --git a/assets/data/items.ron b/assets/data/items.ron
index e31f015..c615b13 100644
--- a/assets/data/items.ron
+++ b/assets/data/items.ron
@@ -72,4 +72,12 @@
         sprite_index: 8,
         name: "spice",
     ),
+    "enhanced_plating": (
+        stat_effects: {
+            "health_increase": .2,
+        },
+        price: 11,
+        sprite_index: 9,
+        name: "enhanced_plating"
+    ),
 }
\ No newline at end of file
diff --git a/assets/texture/items_spritesheet.png b/assets/texture/items_spritesheet.png
index 4740c63..9efd4cf 100644
Binary files a/assets/texture/items_spritesheet.png and b/assets/texture/items_spritesheet.png differ
diff --git a/assets/texture/items_spritesheet.ron b/assets/texture/items_spritesheet.ron
index f001768..b35a616 100644
--- a/assets/texture/items_spritesheet.ron
+++ b/assets/texture/items_spritesheet.ron
@@ -1,5 +1,5 @@
 (
-    texture_width: 140,
+    texture_width: 154,
     texture_height: 14,
     sprites: [
         (
@@ -56,5 +56,11 @@
             width: 14,
             height: 14,
         ),
+        (
+            x: 126,
+            y: 0,
+            width: 14,
+            height: 14,
+        ),
     ],
 )
\ No newline at end of file
diff --git a/src/systems/item.rs b/src/systems/item.rs
index 19f8579..a8141b8 100644
--- a/src/systems/item.rs
+++ b/src/systems/item.rs
@@ -92,6 +92,12 @@ impl<'s> System<'s> for ItemSystem {
                         spaceship.deceleration_y += item.stat_effects["deceleration"];
                     }
 
+                    if item.stat_effects.contains_key("health_increase"){
+                        spaceship.max_health = spaceship.max_health + (item.stat_effects["health_increase"] * spaceship.max_health);
+                        spaceship.health = spaceship.max_health;
+                    }
+
+
                     play_sfx(&sounds.item_sfx, &storage, audio_output.as_ref().map(|o| o.deref()));
 
                     let _result = entities.delete(item_entity);


Test patch: