From 7766abcb37644f1ef65c1374a587b2f8ffbd1e47 Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Sun, 13 Jul 2014 17:05:01 +0200 Subject: [PATCH] Added item descriptions. --- src/StoreItem.hx | 53 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/src/StoreItem.hx b/src/StoreItem.hx index 42e0605..33164a0 100644 --- a/src/StoreItem.hx +++ b/src/StoreItem.hx @@ -21,6 +21,15 @@ class StoreItem extends Entity { this.x += 120; + description = new Text(itemDescription[type][1], 0, 0, 550); + description.wordWrap = true; + description.color = 0xFFFFFF; + description.size = 22; + description.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName; + + description.x -= 450; + description.y += 50; + setHitbox(button.width * 2, button.height * 2); text.centerOrigin(); @@ -40,16 +49,21 @@ class StoreItem extends Entity { this.addGraphic(button); this.addGraphic(text); + this.addGraphic(description); } public override function update() { super.update(); + + description.wordWrap = true; + description.text = itemDescription[which][currentSprite] + " $" + prices[which][currentSprite]; graphic = sprites[currentSprite]; this.addGraphic(button); this.addGraphic(text); + this.addGraphic(description); } public function goLeft() { @@ -69,6 +83,7 @@ class StoreItem extends Entity { private var button:Image; private var sprites:Array = []; private var text:Text; + private var description:Text; public static var itemnames:Array = [ "Fat Jumper", @@ -104,21 +119,47 @@ class StoreItem extends Entity { ] ]; + private var itemDescription:Array> = [ + [ + "The Fat Jumper is the slowest craft, but the strongest.\nIt has 1 canon.", + "The Fat Jumper is the slowest craft, but the strongest.\nIt has 1 canon & some extra health (1).", + "The Fat Jumper is the slowest craft, but the strongest.\nIt has 1 canon & some extra health (2)." + ], + [ + "The Speed Jumper is slightly faster & has slightly less health.\nHas 2 canons.", + "The Speed Jumper is slightly faster & has slightly less health.\nHas 2 canons & extra health (1).", + "The Speed Jumper is slightly faster & has slightly less health.\nHas 2 canons & extra health (2)." + ], + [ + "The X3 is the fastest craft, but with the least health.\nIt has 3 laser canons.", + "The X3 is the fastest craft, but with the least health.\nIt has 3 laser canons & some extra health (1).", + "The X3 is the fastest craft, but with the least health.\nIt has 3 laser canons & some extra health (2).", + ], + [ + "This is the laser you start with, it's decent & does 1 damage.", + "This laser is slightly better than the one you start with, it does 1.5 damage.", + "This laser does the same amount of damage as you're first, but moves slighly faster." + ], + [ + "This heavy laser is the strongest laser, it serves as a secondary. To use, hold the shoot button for a few seconds & then release." + ] + ]; + private var prices:Array> = [ [ 50000, - 50000, - 50000 + 70000, + 90000 ], [ 100000, - 100000, - 100000 + 120000, + 140000 ], [ 150000, - 150000, - 150000 + 200000, + 300000 ], [ 50000,