Did several tweaks for less memory usage and fixed StoreArrows.hx not working correctly.

This commit is contained in:
Bram van der Veen 2014-07-26 20:30:12 +02:00
parent 0a4984359d
commit d7b0f93a41
6 changed files with 31 additions and 40 deletions

View file

@ -4,7 +4,7 @@
<app file="Main" main="Main" path="bin" /> <app file="Main" main="Main" path="bin" />
<window fps="120þ" background="0x000000" /> <window fps="60" background="0x000000" />
<window width="360" height="640" resizable="false" unless="mobile" /> <window width="360" height="640" resizable="false" unless="mobile" />
<window orientation="portrait" fullscreen="true" if="mobile" /> <window orientation="portrait" fullscreen="true" if="mobile" />
<window orientation="portrait" vsync="true" antialiasing="8" if="cpp" /> <window orientation="portrait" vsync="true" antialiasing="8" if="cpp" />
@ -12,10 +12,9 @@
<source path="src" /> <source path="src" />
<haxelib name="HaxePunk" /> <haxelib name="HaxePunk" />
<haxelib name="openfl" version="1.4.0" /> <!-- <haxelib name="openfl" version="1.4.0" /> -->
<assets path="assets/graphics" rename="graphics" include="*.png|*.jpg" /> <assets path="assets/graphics" rename="graphics" include="*.png|*.jpg" />
<assets path="assets/save" rename="save" include="*.save" />
<assets path="assets/audio" rename="audio" include="*.mp3" if="flash" /> <assets path="assets/audio" rename="audio" include="*.mp3" if="flash" />
<assets path="assets/audio" rename="audio" include="*.wav|*.ogg" unless="flash" /> <assets path="assets/audio" rename="audio" include="*.wav|*.ogg" unless="flash" />
<assets path="assets/font" rename="font" include="*.ttf" /> <assets path="assets/font" rename="font" include="*.ttf" />

View file

@ -15,7 +15,7 @@ class Boss extends Entity {
public function new (clr:Int) { public function new (clr:Int) {
color = clr; color = clr;
currentSprite = sprites[color]; currentSprite = new Image(sprites[color]);
currentSprite.scale = 8; currentSprite.scale = 8;
currentSprite.smooth = false; currentSprite.smooth = false;
@ -108,11 +108,11 @@ class Boss extends Entity {
private var currentSprite:Image; private var currentSprite:Image;
private var sprites:Array<Image> = [ private var sprites:Array<String> = [
new Image("graphics/ufoGreen.png"), "graphics/ufoGreen.png",
new Image("graphics/ufoBlue.png"), "graphics/ufoBlue.png",
new Image("graphics/ufoRed.png"), "graphics/ufoRed.png",
new Image("graphics/ufoYellow.png") "graphics/ufoYellow.png"
]; ];
private var color:Int; private var color:Int;

View file

@ -22,6 +22,8 @@ class EnemyBullet extends Entity {
graphic = sprite[0]; graphic = sprite[0];
type = "enemybullet"; type = "enemybullet";
layer = -4;
} }
public override function update() { public override function update() {

View file

@ -18,6 +18,10 @@ class Lives extends Entity {
maxDamage = Save.load().ship_type + Save.load().ship_color; maxDamage = Save.load().ship_type + Save.load().ship_color;
if (Save.load().ship_type == 1) {maxDamage++;};
trace(maxDamage);
liveBar = Image.createRect(Math.floor(baseSprite.width * .75), 10, 0x00FF00); liveBar = Image.createRect(Math.floor(baseSprite.width * .75), 10, 0x00FF00);
liveBar.y += 65; liveBar.y += 65;

View file

@ -28,7 +28,7 @@ class Pickup extends Entity {
rand = Math.floor(Math.random() * 3); rand = Math.floor(Math.random() * 3);
graphic = currentSprite = sprites[randType][rand]; graphic = currentSprite = new Image(sprites[randType][rand]);
if (Math.random() > .5) if (Math.random() > .5)
turnSpeed = -1 * (Math.random() * 4); turnSpeed = -1 * (Math.random() * 4);
@ -80,21 +80,21 @@ class Pickup extends Entity {
} }
private var sprites:Array<Array<Image>> = [ private var sprites:Array<Array<String>> = [
[ [
new Image("graphics/shield_bronze.png"), "graphics/shield_bronze.png",
new Image("graphics/shield_silver.png"), "graphics/shield_silver.png",
new Image("graphics/shield_gold.png") "graphics/shield_gold.png"
], ],
[ [
new Image("graphics/things_bronze.png"), "graphics/things_bronze.png",
new Image("graphics/things_silver.png"), "graphics/things_silver.png",
new Image("graphics/things_gold.png") "graphics/things_gold.png"
], ],
[ [
new Image("graphics/star_bronze.png"), "graphics/star_bronze.png",
new Image("graphics/star_silver.png"), "graphics/star_silver.png",
new Image("graphics/star_gold.png") "graphics/star_gold.png"
] ]
]; ];

View file

@ -7,10 +7,10 @@ import StoreItem;
class StoreArrows extends Entity { class StoreArrows extends Entity {
public function new(x:Float, y:Float, type:Int) { public function new(x:Float, y:Float, z:Int) {
super(x - 230, y); super(x - 230, y);
which = type; which = z;
if (type != 4) if (z != 4)
currentItem = 1; currentItem = 1;
else else
currentItem = 0; currentItem = 0;
@ -43,20 +43,20 @@ class StoreArrows extends Entity {
arrowLeft.visible = false; arrowLeft.visible = false;
else else
arrowLeft.visible = true; arrowLeft.visible = true;
if (currentItem == storeItems[which].items[which].length - 1) if (currentItem == storeItems[which].items[which].length - 1)
arrowRight.visible = false; arrowRight.visible = false;
else else
arrowRight.visible = true; arrowRight.visible = true;
if (Input.mouseReleased) { if (Input.mouseReleased) {
if (Input.mouseY > this.top && Input.mouseY < this.bottom) { if (Input.mouseY > this.top && Input.mouseY < this.bottom) {
if (Input.mouseX > this.left && Input.mouseX < this.left + 100) { if (Input.mouseX > this.left && Input.mouseX < this.left + 100) {
storeItems[which].goLeft(); storeItems[(storeItems.length - 1) - which].goLeft();
if (currentItem != 0) currentItem--; if (currentItem != 0) currentItem--;
} }
if (Input.mouseX < this.right && Input.mouseX > this.right - 100) { if (Input.mouseX < this.right && Input.mouseX > this.right - 100) {
storeItems[which].goRight(); storeItems[(storeItems.length - 1) - which].goRight();
if (currentItem != storeItems[which].items[which].length - 1) currentItem++; if (currentItem != storeItems[which].items[which].length - 1) currentItem++;
} }
} }
@ -64,20 +64,6 @@ class StoreArrows extends Entity {
} }
private function onTouch(touch:Touch) {
var storeItems:Array<StoreItem> = [];
this.scene.getClass(StoreItem, storeItems);
if (touch.y > this.top && touch.y < this.bottom) {
if (touch.x > this.left && touch.x < this.left + 100) {
storeItems[which].goLeft();
}
if (touch.x < this.right && touch.x > this.right - 100) {
storeItems[which].goRight();
}
}
}
private var arrowLeft:Image; private var arrowLeft:Image;
private var arrowRight:Image; private var arrowRight:Image;
private var which:Int; private var which:Int;