Did some minor tweaks for better gameplay

This commit is contained in:
Bram van der Veen 2014-08-01 13:01:38 +02:00
parent cfa3a60528
commit 3284c129fb
8 changed files with 44 additions and 26 deletions

View file

@ -6,7 +6,7 @@
<window fps="60" 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" height="1280" width="720" 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" />
<source path="src" /> <source path="src" />

View file

@ -90,25 +90,30 @@ class Boss extends Entity {
var bullet:Entity = this.collide("bullet", this.x, this.y); var bullet:Entity = this.collide("bullet", this.x, this.y);
var heavybullet:Entity = this.collide("heavybullet", this.x, this.y); var heavybullet:Entity = this.collide("heavybullet", this.x, this.y);
var score:Array<Score> = [];
this.scene.getClass(Score, score);
if (bullet != null || heavybullet != null) { if (bullet != null) {
var score:Array<Score> = [];
this.scene.getClass(Score, score);
score[0].add(1500); score[0].add(1500);
} }
if (heavybullet != null) {
score[0].add(10);
}
if (bullet != null) { if (bullet != null) {
if (Save.load().laser == 0) if (Save.load().laser == 0)
damage = 1; damage = 1;
else if (Save.load().laser == 1) else if (Save.load().laser == 1)
damage = 1.25;
else if (Save.load().laser == 2)
damage = 1.5; damage = 1.5;
this.health -= damage; this.health -= damage;
this.scene.remove(bullet); this.scene.remove(bullet);
} }
else if (heavybullet != null) { else if (heavybullet != null) {
this.health -= 2; if (Save.load().heavy_laser == 0)
this.health -= .5;
else
this.health -= 1;
} }
} }

View file

@ -8,14 +8,18 @@ class Bullet extends Entity {
super(x, y); super(x, y);
isHeavyLaser = heavylaser; isHeavyLaser = heavylaser;
which = Save.load().laser; if (!isHeavyLaser)
which = Save.load().laser;
else
which = Save.load().heavy_laser;
if (!isHeavyLaser) { if (!isHeavyLaser) {
laser1 = new Image(laser[which][0]); laser1 = new Image(laser[which][0]);
laser2 = new Image(laser[which][1]); laser2 = new Image(laser[which][1]);
} }
else { else {
laser1 = new Image("graphics/laserBlue15.png"); laser1 = new Image(heavy_laser[which][0]);
laser2 = new Image("graphics/laserBlue16.png"); laser2 = new Image(heavy_laser[which][1]);
} }
graphic = laser1; graphic = laser1;
@ -65,16 +69,23 @@ class Bullet extends Entity {
"graphics/laserGreen04.png", "graphics/laserGreen04.png",
"graphics/laserGreen12.png" "graphics/laserGreen12.png"
], ],
[
"graphics/laserGreen10.png",
"graphics/laserGreen06.png"
],
[ [
"graphics/laserBlue02.png", "graphics/laserBlue02.png",
"graphics/laserBlue06.png" "graphics/laserBlue06.png"
] ]
]; ];
private var heavy_laser:Array<Array<String>> = [
[
"graphics/laserGreen06.png",
"graphics/laserGreen10.png"
],
[
"graphics/laserBlue15.png",
"graphics/laserBlue16.png"
]
];
private var laser1:Image; private var laser1:Image;
private var laser2:Image; private var laser2:Image;
private var isHeavyLaser:Bool = false; private var isHeavyLaser:Bool = false;

View file

@ -144,8 +144,6 @@ class Enemy extends Entity {
if (Save.load().laser == 0) if (Save.load().laser == 0)
damage = 1; damage = 1;
else if (Save.load().laser == 1) else if (Save.load().laser == 1)
damage = 1.25;
else if (Save.load().laser == 2)
damage = 1.5; damage = 1.5;
health -= damage; health -= damage;
var score:Array<Score> = []; var score:Array<Score> = [];
@ -156,7 +154,10 @@ class Enemy extends Entity {
this.scene.remove(bullet); this.scene.remove(bullet);
} }
else if (heavybullet != null) { else if (heavybullet != null) {
this.health -= 2; if (Save.load().heavy_laser == 0)
this.health -= .5;
else
this.health -= 1;
} }
if (health <= 0) { if (health <= 0) {

View file

@ -13,6 +13,8 @@ class Main extends Engine
#if !android #if !android
HXP.screen.scale = .5; HXP.screen.scale = .5;
HXP.resize(360, 640); HXP.resize(360, 640);
#else
HXP.resize(720, 1280);
#end #end
HXP.scene = new MenuScene(); HXP.scene = new MenuScene();

View file

@ -96,7 +96,7 @@ class Player extends Entity {
} }
if (Input.released("shoot")) { if (Input.released("shoot")) {
if (holdShoot > .5 && Save.load().has_heavy_laser) { if (holdShoot > .5) {
heavyShoot(); heavyShoot();
holdShoot = 0; holdShoot = 0;
} }

View file

@ -19,7 +19,7 @@ class Save extends Entity {
"ship_type" : Data.readInt("ship_type", 3), "ship_type" : Data.readInt("ship_type", 3),
"ship_color" : Data.readInt("ship_color", 1), "ship_color" : Data.readInt("ship_color", 1),
"laser" : Data.readInt("laser", 0), "laser" : Data.readInt("laser", 0),
"has_heavy_laser" : Data.readBool("heavy_laser", false), "heavy_laser" : Data.readInt("heavy_laser", 0),
"money" : Data.readInt("money", 1000), "money" : Data.readInt("money", 1000),
"overlay" : Data.readBool("overlay", true) "overlay" : Data.readBool("overlay", true)
}; };
@ -33,7 +33,7 @@ class Save extends Entity {
Data.write("ship_type", 3); Data.write("ship_type", 3);
Data.write("ship_color", 1); Data.write("ship_color", 1);
Data.write("laser", "laserGreen04.png"); Data.write("laser", "laserGreen04.png");
Data.write("heavy_laser", false); Data.write("heavy_laser", 0);
Data.write("money", 1000); Data.write("money", 1000);
Data.write("overlay", true); Data.write("overlay", true);

View file

@ -44,8 +44,7 @@ class StoreItem extends Entity {
sprites[i].centerOrigin(); sprites[i].centerOrigin();
} }
if (type != 4) currentSprite = 1; currentSprite = 1;
else currentSprite = 0;
this.addGraphic(sprites[currentSprite]); this.addGraphic(sprites[currentSprite]);
@ -90,7 +89,7 @@ class StoreItem extends Entity {
} }
else { else {
if (which == 4) if (which == 4)
Save.save("heavy_laser", true); Save.save("heavy_laser", currentSprite);
else else
Save.save("laser", currentSprite); Save.save("laser", currentSprite);
} }
@ -145,10 +144,10 @@ class StoreItem extends Entity {
], ],
[ [
"laserGreen04.png", "laserGreen04.png",
"laserGreen06.png",
"laserBlue06.png" "laserBlue06.png"
], ],
[ [
"laserGreen06.png",
"laserBlue16.png" "laserBlue16.png"
] ]
]; ];
@ -171,10 +170,10 @@ class StoreItem extends Entity {
], ],
[ [
"This is the laser you start with, it's decent & does 1 damage.", "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 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.",
"This heavy laser is the strongest laser, it serves as a secondary. To use, hold the shoot button for a few seconds & then release." "This heavy laser is the strongest laser, it serves as a secondary. To use, hold the shoot button for a few seconds & then release."
] ]
]; ];
@ -196,11 +195,11 @@ class StoreItem extends Entity {
500000 500000
], ],
[ [
50000,
100000, 100000,
150000 150000
], ],
[ [
100000,
200000 200000
] ]