Added new graphics and added a StoreScene.hx

This commit is contained in:
Bram van der Veen 2014-07-11 16:55:53 +02:00
parent 24b54b5c8b
commit d42612e819
31 changed files with 152 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -7,12 +7,12 @@ class Bullet extends Entity {
public function new(x:Float, y:Float) { public function new(x:Float, y:Float) {
super(x, y); super(x, y);
laser1 = new Image("graphics/laserGreen09.png"); laser1 = new Image("graphics/laserGreen04.png");
laser2 = new Image("graphics/laserGreen13.png"); laser2 = new Image("graphics/laserGreen12.png");
graphic = laser1; graphic = laser1;
setHitbox(9, 37); setHitboxTo(laser1);
type = "bullet"; type = "bullet";

View file

@ -15,8 +15,7 @@ class Main extends Engine
HXP.resize(360, 640); HXP.resize(360, 640);
#end #end
// HXP.scene = new MainScene(); HXP.scene = new StoreScene();
HXP.scene = new MenuScene();
} }
public static function main() { new Main(); } public static function main() { new Main(); }

124
src/StoreItem.hx Normal file
View file

@ -0,0 +1,124 @@
import com.haxepunk.Entity;
import com.haxepunk.graphics.Image;
import com.haxepunk.graphics.Text;
import openfl.Assets;
class StoreItem extends Entity {
public function new(x:Float, y:Float, type:Int) {
super(x, y);
button = new Image("graphics/buttonGreen.png");
button.scale = 2;
text = new Text(itemnames[type]);
text.color = 0x000000;
text.size = 40;
text.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName;
this.x += 120;
setHitbox(button.width * 2, button.height * 2);
text.centerOrigin();
button.centerOrigin();
this.centerOrigin();
for (i in 0...items[type].length) {
sprites[i] = new Image("graphics/" + items[type][i]);
sprites[i].x = -350;
sprites[i].centerOrigin();
}
arrowLeft = new Image("graphics/fire05.png");
arrowLeft.angle = 90;
arrowLeft.x = -440;
arrowLeft.centerOrigin();
arrowRight = new Image("graphics/fire05.png");
arrowRight.angle = -90;
arrowRight.x = -260;
arrowRight.centerOrigin();
this.addGraphic(sprites[0]);
this.addGraphic(arrowLeft);
this.addGraphic(arrowRight);
this.addGraphic(button);
this.addGraphic(text);
}
private var button:Image;
private var sprites:Array<Image> = [];
private var arrowLeft:Image;
private var arrowRight:Image;
private var text:Text;
public static var itemnames:Array<String> = [
"Fat Jumper",
"Speeder Jumper",
"X3 Jumper",
"V2 Laser",
"Heavy Laser"
];
private var items:Array<Array<String>> = [
[
"playerShip3_green.png",
"playerShip3_blue.png",
"playerShip3_orange.png"
],
[
"playerShip1_green.png",
"playerShip1_blue.png",
"playerShip1_orange.png"
],
[
"playerShip2_green.png",
"playerShip2_blue.png",
"playerShip2_orange.png"
],
[
"laserGreen06.png",
"laserBlue06.png"
],
[
"laserBlue16.png"
]
];
private var prices:Array<Array<Int>> = [
[
50000,
50000,
50000
],
[
100000,
100000,
100000
],
[
150000,
150000,
150000
],
[
50000,
100000
],
[
150000
]
];
}

24
src/StoreScene.hx Normal file
View file

@ -0,0 +1,24 @@
import com.haxepunk.Scene;
import com.haxepunk.graphics.Backdrop;
import com.haxepunk.HXP;
import StoreItem;
class StoreScene extends Scene {
public override function begin() {
backdrop = new Backdrop("graphics/darkPurple.png", true, true);
addGraphic(backdrop);
for (i in 0...StoreItem.itemnames.length) {
add(new StoreItem(HXP.halfWidth, 200 + (i * 200), i));
}
}
public override function update() {
super.update();
backdrop.y += 1;
}
private var backdrop:Backdrop;
}