From 3284c129fba54c04d23cbc9cd27ae3fd88dde6c7 Mon Sep 17 00:00:00 2001
From: Bram van der Veen <96aa48@gmail.com>
Date: Fri, 1 Aug 2014 13:01:38 +0200
Subject: [PATCH] Did some minor tweaks for better gameplay
---
project.xml | 2 +-
src/Boss.hx | 17 +++++++++++------
src/Bullet.hx | 25 ++++++++++++++++++-------
src/Enemy.hx | 7 ++++---
src/Main.hx | 2 ++
src/Player.hx | 2 +-
src/Save.hx | 4 ++--
src/StoreItem.hx | 11 +++++------
8 files changed, 44 insertions(+), 26 deletions(-)
diff --git a/project.xml b/project.xml
index b827a79..49f7f2f 100644
--- a/project.xml
+++ b/project.xml
@@ -6,7 +6,7 @@
-
+
diff --git a/src/Boss.hx b/src/Boss.hx
index f080fa9..ac7da85 100644
--- a/src/Boss.hx
+++ b/src/Boss.hx
@@ -90,25 +90,30 @@ class Boss extends Entity {
var bullet:Entity = this.collide("bullet", this.x, this.y);
var heavybullet:Entity = this.collide("heavybullet", this.x, this.y);
+ var score:Array = [];
+ this.scene.getClass(Score, score);
- if (bullet != null || heavybullet != null) {
- var score:Array = [];
- this.scene.getClass(Score, score);
+ if (bullet != null) {
score[0].add(1500);
}
+ if (heavybullet != null) {
+ score[0].add(10);
+ }
+
if (bullet != null) {
if (Save.load().laser == 0)
damage = 1;
else if (Save.load().laser == 1)
- damage = 1.25;
- else if (Save.load().laser == 2)
damage = 1.5;
this.health -= damage;
this.scene.remove(bullet);
}
else if (heavybullet != null) {
- this.health -= 2;
+ if (Save.load().heavy_laser == 0)
+ this.health -= .5;
+ else
+ this.health -= 1;
}
}
diff --git a/src/Bullet.hx b/src/Bullet.hx
index 3e51952..7847ac5 100644
--- a/src/Bullet.hx
+++ b/src/Bullet.hx
@@ -8,14 +8,18 @@ class Bullet extends Entity {
super(x, y);
isHeavyLaser = heavylaser;
- which = Save.load().laser;
+ if (!isHeavyLaser)
+ which = Save.load().laser;
+ else
+ which = Save.load().heavy_laser;
+
if (!isHeavyLaser) {
laser1 = new Image(laser[which][0]);
laser2 = new Image(laser[which][1]);
}
else {
- laser1 = new Image("graphics/laserBlue15.png");
- laser2 = new Image("graphics/laserBlue16.png");
+ laser1 = new Image(heavy_laser[which][0]);
+ laser2 = new Image(heavy_laser[which][1]);
}
graphic = laser1;
@@ -65,16 +69,23 @@ class Bullet extends Entity {
"graphics/laserGreen04.png",
"graphics/laserGreen12.png"
],
- [
- "graphics/laserGreen10.png",
- "graphics/laserGreen06.png"
- ],
[
"graphics/laserBlue02.png",
"graphics/laserBlue06.png"
]
];
+ private var heavy_laser:Array> = [
+ [
+ "graphics/laserGreen06.png",
+ "graphics/laserGreen10.png"
+ ],
+ [
+ "graphics/laserBlue15.png",
+ "graphics/laserBlue16.png"
+ ]
+ ];
+
private var laser1:Image;
private var laser2:Image;
private var isHeavyLaser:Bool = false;
diff --git a/src/Enemy.hx b/src/Enemy.hx
index fe1d3b5..86cd005 100644
--- a/src/Enemy.hx
+++ b/src/Enemy.hx
@@ -144,8 +144,6 @@ class Enemy extends Entity {
if (Save.load().laser == 0)
damage = 1;
else if (Save.load().laser == 1)
- damage = 1.25;
- else if (Save.load().laser == 2)
damage = 1.5;
health -= damage;
var score:Array = [];
@@ -156,7 +154,10 @@ class Enemy extends Entity {
this.scene.remove(bullet);
}
else if (heavybullet != null) {
- this.health -= 2;
+ if (Save.load().heavy_laser == 0)
+ this.health -= .5;
+ else
+ this.health -= 1;
}
if (health <= 0) {
diff --git a/src/Main.hx b/src/Main.hx
index 8c27b7a..ae1e353 100644
--- a/src/Main.hx
+++ b/src/Main.hx
@@ -13,6 +13,8 @@ class Main extends Engine
#if !android
HXP.screen.scale = .5;
HXP.resize(360, 640);
+ #else
+ HXP.resize(720, 1280);
#end
HXP.scene = new MenuScene();
diff --git a/src/Player.hx b/src/Player.hx
index 2b39dac..b95e98c 100644
--- a/src/Player.hx
+++ b/src/Player.hx
@@ -96,7 +96,7 @@ class Player extends Entity {
}
if (Input.released("shoot")) {
- if (holdShoot > .5 && Save.load().has_heavy_laser) {
+ if (holdShoot > .5) {
heavyShoot();
holdShoot = 0;
}
diff --git a/src/Save.hx b/src/Save.hx
index 2ed179e..0c443eb 100644
--- a/src/Save.hx
+++ b/src/Save.hx
@@ -19,7 +19,7 @@ class Save extends Entity {
"ship_type" : Data.readInt("ship_type", 3),
"ship_color" : Data.readInt("ship_color", 1),
"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),
"overlay" : Data.readBool("overlay", true)
};
@@ -33,7 +33,7 @@ class Save extends Entity {
Data.write("ship_type", 3);
Data.write("ship_color", 1);
Data.write("laser", "laserGreen04.png");
- Data.write("heavy_laser", false);
+ Data.write("heavy_laser", 0);
Data.write("money", 1000);
Data.write("overlay", true);
diff --git a/src/StoreItem.hx b/src/StoreItem.hx
index 7b1920e..75bad61 100644
--- a/src/StoreItem.hx
+++ b/src/StoreItem.hx
@@ -44,8 +44,7 @@ class StoreItem extends Entity {
sprites[i].centerOrigin();
}
- if (type != 4) currentSprite = 1;
- else currentSprite = 0;
+ currentSprite = 1;
this.addGraphic(sprites[currentSprite]);
@@ -90,7 +89,7 @@ class StoreItem extends Entity {
}
else {
if (which == 4)
- Save.save("heavy_laser", true);
+ Save.save("heavy_laser", currentSprite);
else
Save.save("laser", currentSprite);
}
@@ -145,10 +144,10 @@ class StoreItem extends Entity {
],
[
"laserGreen04.png",
- "laserGreen06.png",
"laserBlue06.png"
],
[
+ "laserGreen06.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 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.",
"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
],
[
- 50000,
100000,
150000
],
[
+ 100000,
200000
]