Added/Fixed a lot of things :

* added heavy laser
* fixed enemies spawning together with level boss.
* added new icon
* added more stuff, can't remember.
This commit is contained in:
Bram van der Veen 2014-07-17 01:59:44 +02:00
parent 6b4c4a452d
commit 8708678639
7 changed files with 121 additions and 18 deletions

View file

@ -1,2 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="256" height="256" xml:space="preserve"><path d="m 122.75712,200.98018 c -2.38603,5.82245 -5.93976,11.27435 -10.66384,15.99843 -19.072296,19.07229 -49.992115,19.07229 -69.067068,0 -19.072287,-19.06962 -19.072287,-49.99211 0,-69.05906 19.074953,-19.07762 49.994772,-19.07762 69.067068,0 4.70275,4.69742 8.24315,10.12265 10.62652,15.90512 4.7854,10.36259 4.37484,27.09417 0.0373,37.15551 m 100.3308,-0.29859 c 0.69315,-0.75447 1.35162,-1.54093 1.96215,-2.36471 l 3.54837,1.4956 2.2261,-3.85764 -2.98588,-2.25807 c 1.3783,-2.86858 2.2874,-5.99841 2.64197,-9.29887 l 3.83365,-0.47721 0,-4.45482 -3.76967,-0.47188 c -0.26393,-3.29246 -1.08771,-6.4303 -2.37537,-9.3122 l 3.15117,-2.38337 -2.22608,-3.85765 -3.59638,1.51427 c -1.82885,-2.61531 -4.08692,-4.9107 -6.67024,-6.7902 l 1.58625,-3.76701 -3.85232,-2.22874 -2.44202,3.22581 c -2.80725,-1.31165 -5.85978,-2.18075 -9.0696,-2.51666 l -0.52786,-4.19623 0,0 0,-0.002 -4.45216,0 -0.5172,4.15623 c -1.27699,0.10664 -2.53,0.30659 -3.75367,0.57852 l 0,-76.091867 -32.55672,6.262343 0,-16.80622 -8.57906,-2.503338 0,20.959788 -7.29674,1.402295 0,-38.640442 -8.13651,1.250336 0,38.955026 -8.54708,1.642232 0,44.414917 -11.58093,-11.58094 -9.98403,4.24154 -1.72754,-10.64518 -23.737724,-6.35832 -6.526273,8.66438 -6.819529,-8.35513 -23.737719,6.36099 -1.316985,10.76782 -10.082666,-3.82832 -17.379401,17.3794 4.24421,9.98402 -10.647849,1.72488 -6.3609839,23.74038 8.6670399,6.52628 -8.3551224,6.81686 6.3583174,23.74039 10.770484,1.31698 -3.828321,10.08267 17.376736,17.3794 9.986691,-4.24421 1.727543,10.64518 23.737719,6.36365 6.526273,-8.66971 6.819529,8.35513 23.737721,-6.35566 1.31965,-10.77048 10.08,3.82566 10.73316,-10.7305 0,22.62335 120.6241,0.12797 0,-25.86516 -28.2192,-26.8409 z" style="fill:#fd8f00;fill-opacity:1;fill-rule:nonzero;stroke:none"/><path d="m 150.49991,33.90865 c 0,6.051732 -4.50014,8.451097 -8.50975,8.451097 -4.00694,0 -11.01308,-3.652367 -11.01308,-9.704099 0,-6.051732 7.00614,-11.27435 11.01308,-11.27435 4.00961,0 8.50975,6.472954 8.50975,12.527352" style="fill:#fd8f00;fill-opacity:1;fill-rule:nonzero;stroke:none"/><path d="m 139.45323,21.160556 c 0,7.41937 -6.69689,13.436445 -13.56974,13.436445 -6.87285,0 -13.56974,-3.772335 -13.56974,-11.191706 0,-7.422036 6.69689,-12.314074 13.56974,-12.314074 6.87285,0 13.56974,2.647299 13.56974,10.069335" style="fill:#fd8f00;fill-opacity:1;fill-rule:nonzero;stroke:none"/><path d="m 167.60605,54.112904 c -3.40176,0.879767 -6.79287,-0.839778 -7.56866,-3.846982 -0.7758,-3.001873 0.97841,-7.600656 4.38284,-8.480423 3.40443,-0.879767 5.71849,2.665961 6.49428,5.6705 0.77579,3.004538 0.096,5.774472 -3.30846,6.656905" style="fill:#fd8f00;fill-opacity:1;fill-rule:nonzero;stroke:none"/><path d="m 169.28667,21.034445 c 0,2.074118 -1.68222,3.75634 -3.75634,3.75634 -2.07678,0 -3.75633,-2.935223 -3.75633,-5.009341 0,-2.074118 1.67955,-3.75634 3.75633,-3.75634 2.07412,0 3.75634,2.935224 3.75634,5.009341" style="fill:#fd8f00;fill-opacity:1;fill-rule:nonzero;stroke:none"/><path d="m 102.12845,9.5049737 c 0,1.2210103 -2.444695,2.2100823 -3.913645,2.2100823 -1.46894,0 -2.660625,-0.989072 -2.660625,-2.2100823 0,-1.2210103 1.191685,-3.4630837 2.660625,-3.4630837 1.46895,0 3.913645,2.2420734 3.913645,3.4630837" style="fill:#fd8f00;fill-opacity:1;fill-rule:nonzero;stroke:none"/><path d="m 117.78324,182.44614 c 0,-6.71823 -1.56759,-13.04722 -4.47082,-18.61908 -6.73155,-12.92724 -20.165336,-21.76224 -35.750546,-21.76224 -6.87818,0 -13.345802,1.62357 -19.01097,4.64944 -12.927246,6.73421 -21.764908,20.144 -21.764908,35.73188 0,15.59054 8.837662,29.00032 21.764908,35.73454 5.665168,3.02853 12.13279,4.64944 19.01097,4.64944 15.619867,0 29.077646,-8.87497 35.793206,-21.8502 2.87657,-5.55322 4.42816,-11.84753 4.42816,-18.53376" style="fill:#fd8f00;fill-opacity:1;fill-rule:nonzero;stroke:none"/></svg> <svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="256"
height="256"
xml:space="preserve"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="HaxePunk.svg"><metadata
id="metadata22"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs20" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="1026"
id="namedview18"
showgrid="false"
inkscape:zoom="2.6074563"
inkscape:cx="116.79706"
inkscape:cy="147.71227"
inkscape:window-x="1440"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><path
style="fill:#f2f2f2;fill-opacity:1;stroke:#000000;stroke-width:2.62683249px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 60.541756,183.88057 34.777269,48.64502 63.923915,0.38302 37.75816,-48.64502 -60.943,-162.022371 -16.5606,0.383051 z"
id="path3098"
inkscape:connector-curvature="0" /><path
style="fill:#de532c;fill-opacity:1;stroke:#000000;stroke-width:2.62683249px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 151.52806,63.001239 93.40179,127.166481 0,18.3855 -15.89819,0 -2.31848,-4.59638 -45.70725,0 16.5606,-18.38551 -44.0512,-121.420995 z"
id="path3100"
inkscape:connector-curvature="0" /><path
style="fill:#de532c;fill-opacity:1;stroke:#000000;stroke-width:2.62683249px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 105.82081,59.553952 10.1005,190.93376 9.7692956,207.0211 l 19.5415114,1.91517 -0.662433,-6.51155 45.044842,0.38302 -12.917255,-17.61943 z"
id="path3102"
inkscape:connector-curvature="0" /><path
style="fill:#4a3c55;fill-opacity:1;stroke:#4a3c55;stroke-width:0.25185776;stroke-opacity:1"
d="m 108.87893,114.4919 c 0.75154,-2.78525 15.6231,-54.505886 15.69892,-54.598061 0.0547,-0.06667 1.33752,-0.172034 2.85069,-0.234464 l 2.7512,-0.113276 3.08705,10.932681 c 3.67363,13.010081 8.40035,30.057 10.58939,38.19061 l 1.57744,5.86119 -6.34512,0.16017 c -3.48983,0.0881 -11.7498,0.2096 -18.35549,0.27033 l -12.01036,0.11017 0.15633,-0.57912 0,0 z"
id="path3882"
inkscape:connector-curvature="0" /></svg>

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -89,6 +89,7 @@ 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);
if (bullet != null) { if (bullet != null) {
if (Save.load().laser == 0) if (Save.load().laser == 0)
@ -100,6 +101,9 @@ class Boss extends Entity {
this.health -= damage; this.health -= damage;
this.scene.remove(bullet); this.scene.remove(bullet);
} }
else if (heavybullet != null) {
this.health -= 2;
}
} }
private var currentSprite:Image; private var currentSprite:Image;

View file

@ -4,13 +4,19 @@ import com.haxepunk.HXP;
class Bullet extends Entity { class Bullet extends Entity {
public function new(x:Float, y:Float, ?isHeavyLaser:Bool) { public function new(x:Float, y:Float, ?heavylaser:Bool) {
super(x, y); super(x, y);
isHeavyLaser = heavylaser;
which = Save.load().laser; which = Save.load().laser;
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 {
laser1 = new Image("graphics/laserBlue15.png");
laser2 = new Image("graphics/laserBlue16.png");
}
graphic = laser1; graphic = laser1;
@ -19,20 +25,31 @@ class Bullet extends Entity {
laser2.centerOrigin(); laser2.centerOrigin();
this.centerOrigin(); this.centerOrigin();
type = "bullet"; if (!isHeavyLaser) {
type = "bullet";
}
else {
layer = -4;
type = "heavybullet";
}
} }
public override function update() { public override function update() {
super.update(); super.update();
this.y -= 20; this.y -= moveSpeed;
timer -= HXP.elapsed; timer -= HXP.elapsed;
if (collide("asteroid", this.x, this.y) != null) { if (collide("asteroid", this.x, this.y) != null && !isHeavyLaser) {
this.scene.remove(this); this.scene.remove(this);
} }
else if (collide("asteroid", this.x, this.y) != null && isHeavyLaser) {
if (this.moveSpeed > 5)
this.moveSpeed -= 2;
}
if (timer < 0 || this.y < 200) { if (timer < 0 || this.y < 200) {
graphic = laser2; graphic = laser2;
@ -60,6 +77,8 @@ class Bullet extends Entity {
private var laser1:Image; private var laser1:Image;
private var laser2:Image; private var laser2:Image;
private var isHeavyLaser:Bool = false;
private var moveSpeed:Float = 20;
public var which:Int; public var which:Int;

View file

@ -138,6 +138,7 @@ class Enemy extends Entity {
} }
var bullet:Entity = collide("bullet", this.x, this.y); var bullet:Entity = collide("bullet", this.x, this.y);
var heavybullet:Entity = this.collide("heavybullet", this.x, this.y);
if (bullet != null) { if (bullet != null) {
if (Save.load().laser == 0) if (Save.load().laser == 0)
@ -154,6 +155,9 @@ class Enemy extends Entity {
this.scene.remove(bullet); this.scene.remove(bullet);
} }
else if (heavybullet != null) {
this.health -= 2;
}
if (health <= 0) { if (health <= 0) {
die(); die();

View file

@ -21,11 +21,11 @@ class Player extends Entity {
baseSprite = new Image("graphics/" + Save.load().ship); baseSprite = new Image("graphics/" + Save.load().ship);
if (Save.load().ship_type == 1) if (Save.load().ship_type == 1)
moveSpeed = 7; moveSpeed = 9;
else if (Save.load().ship_type == 2) else if (Save.load().ship_type == 2)
moveSpeed = 5; moveSpeed = 7;
else else
moveSpeed = 4; moveSpeed = 5;
shield = new Image("graphics/shield1.png"); shield = new Image("graphics/shield1.png");
@ -95,16 +95,27 @@ class Player extends Entity {
this.y -= moveSpeed; this.y -= moveSpeed;
} }
if (Input.pressed("shoot")) { if (Input.released("shoot")) {
shoot(); if (holdShoot > .5 && Save.load().has_heavy_laser) {
heavyShoot();
holdShoot = 0;
}
else {
shoot();
holdShoot = 0;
}
}
if (Input.check("shoot")) {
holdShoot += HXP.elapsed;
} }
Input.touchPoints(onTouch); Input.touchPoints(onTouch);
} }
private function onTouch(touch:Touch) { private function onTouch(touch:Touch) {
if (touch.y < HXP.height - 100 && (touch.y > 700) && this.y > 0) if (!(touch.x < 100 && touch.y > HXP.height - 100) && this.y > 0)
this.moveTowards(touch.x - (this.width / 2), touch.y - (this.height * 2), moveSpeed * 1.5); this.moveTowards(touch.x, touch.y - (this.height * 2), moveSpeed);
} }
public function shoot() { public function shoot() {
@ -131,6 +142,17 @@ class Player extends Entity {
} }
} }
public function heavyShoot() {
if (this.y > 0) {
var score:Array<Score> = [];
this.scene.getClass(Score, score);
score[0].rem(1000);
this.scene.add(new Bullet(this.x, this.y - this.height / 2, true));
laser.play();
}
}
public function die() { public function die() {
this.visible = false; this.visible = false;
var score:Array<Score> = []; var score:Array<Score> = [];
@ -223,6 +245,7 @@ class Player extends Entity {
private var hitPause:Float = 0; private var hitPause:Float = 0;
private var animWait:Float = .75; private var animWait:Float = .75;
private var currentAnim:Int = 0; private var currentAnim:Int = 0;
private var holdShoot:Float = 0;
public var shielded:Bool = false; public var shielded:Bool = false;
public var shieldTimer:Float = 1; public var shieldTimer:Float = 1;

View file

@ -16,7 +16,7 @@ class Score extends Entity {
scoreText = new Text("$" + score, 0, 0, 0, 0, {size : 50, align : "center", color : 0xFFF000}); scoreText = new Text("$" + score, 0, 0, 0, 0, {size : 50, align : "center", color : 0xFFF000});
scoreText.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName; scoreText.font = Assets.getFont("font/kenpixel_mini_square.ttf").fontName;
layer = -3; layer = -6;
this.addGraphic(scoreText); this.addGraphic(scoreText);
} }

View file

@ -10,7 +10,7 @@ import Asteroid;
class Spawner extends Entity { class Spawner extends Entity {
public function new() { public function new() {
super(0,0); super();
} }
public override function update() { public override function update() {
@ -39,7 +39,7 @@ class Spawner extends Entity {
enemyTimer = 1; enemyTimer = 1;
} }
if (sublevel == 2 && !bossSpawned) { if (sublevel == 2 && !bossSpawned && enemies.length == 0) {
this.scene.add(new Boss(level)); this.scene.add(new Boss(level));
bossSpawned = true; bossSpawned = true;
} }