Added item descriptions.
This commit is contained in:
parent
f1d78ea861
commit
7766abcb37
|
@ -21,6 +21,15 @@ class StoreItem extends Entity {
|
||||||
|
|
||||||
this.x += 120;
|
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);
|
setHitbox(button.width * 2, button.height * 2);
|
||||||
|
|
||||||
text.centerOrigin();
|
text.centerOrigin();
|
||||||
|
@ -40,16 +49,21 @@ class StoreItem extends Entity {
|
||||||
|
|
||||||
this.addGraphic(button);
|
this.addGraphic(button);
|
||||||
this.addGraphic(text);
|
this.addGraphic(text);
|
||||||
|
this.addGraphic(description);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function update() {
|
public override function update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
|
description.wordWrap = true;
|
||||||
|
description.text = itemDescription[which][currentSprite] + " $" + prices[which][currentSprite];
|
||||||
|
|
||||||
graphic = sprites[currentSprite];
|
graphic = sprites[currentSprite];
|
||||||
|
|
||||||
this.addGraphic(button);
|
this.addGraphic(button);
|
||||||
this.addGraphic(text);
|
this.addGraphic(text);
|
||||||
|
this.addGraphic(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function goLeft() {
|
public function goLeft() {
|
||||||
|
@ -69,6 +83,7 @@ class StoreItem extends Entity {
|
||||||
private var button:Image;
|
private var button:Image;
|
||||||
private var sprites:Array<Image> = [];
|
private var sprites:Array<Image> = [];
|
||||||
private var text:Text;
|
private var text:Text;
|
||||||
|
private var description:Text;
|
||||||
|
|
||||||
public static var itemnames:Array<String> = [
|
public static var itemnames:Array<String> = [
|
||||||
"Fat Jumper",
|
"Fat Jumper",
|
||||||
|
@ -104,21 +119,47 @@ class StoreItem extends Entity {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private var itemDescription:Array<Array<String>> = [
|
||||||
|
[
|
||||||
|
"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<Array<Int>> = [
|
private var prices:Array<Array<Int>> = [
|
||||||
[
|
[
|
||||||
50000,
|
50000,
|
||||||
50000,
|
70000,
|
||||||
50000
|
90000
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
100000,
|
100000,
|
||||||
100000,
|
120000,
|
||||||
100000
|
140000
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
150000,
|
150000,
|
||||||
150000,
|
200000,
|
||||||
150000
|
300000
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
50000,
|
50000,
|
||||||
|
|
Reference in a new issue