Skip to content

Commit

Permalink
finish
Browse files Browse the repository at this point in the history
  • Loading branch information
pateldd1 committed Aug 4, 2017
1 parent 0838a80 commit 3f38a3a
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 72 deletions.
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -5,7 +5,7 @@

<body>

<canvas id="fg-canvas" width="1250" height="650"></canvas>
<canvas id="fg-canvas" width="1240" height="620"></canvas>

<script type="application/javascript" src="vendor/keymaster.js"></script>
<script type="application/javascript" src="lib/bundle.js"></script>
Expand Down
86 changes: 51 additions & 35 deletions lib/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/bundle.js.map

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions lib/game.js
Expand Up @@ -88,19 +88,19 @@ class Game {

switch (stage) {
case 1:
this.addsmallEnemies(3);
this.addsmallEnemies(5);
this.addbigEnemies(1);
this.addmediumEnemies(1);
break;
case 2:
this.addsmallEnemies(4);
this.addsmallEnemies(6);
this.addbigEnemies(1);
this.addmediumEnemies(2);
break;
case 3:
this.addsmallEnemies(6);
this.addsmallEnemies(7);
this.addbigEnemies(2);
this.addmediumEnemies(2);
this.addmediumEnemies(1);
break;
case 4:
this.addboss();
Expand All @@ -116,7 +116,7 @@ class Game {
sry: 0,
pos: [0,0],
mag: 1.8,
vel: Util.scale([4*Math.random() - 2,0], 1.8),
vel: [0,0],
width: 294,
height: 282,
game: this,
Expand All @@ -136,14 +136,14 @@ class Game {
srx: 530,
sry: 1998,
pos: this.enemyrandomPosition(),
mag: 2.3,
vel: Util.scale([2*Math.random(),2*Math.random()], 2.3),
mag: 1.9,
vel: Util.scale([2*Math.random(),2*Math.random()], 1.9),
width: 60,
height: 46,
game: this,
image: enemyImage,
type: "enemy_ship",
lifebar: 3,
lifebar: 5,
bullettype: 1,
isWrappable: true
}));
Expand Down Expand Up @@ -182,14 +182,14 @@ class Game {
srx: 4,
sry: 2,
pos: this.enemyrandomPosition(),
mag: 2,
vel: Util.scale([2*Math.random(),2*Math.random()], 2),
mag: 1.8,
vel: Util.scale([2*Math.random(),2*Math.random()], 1.8),
width: 166,
height: 100,
game: this,
image: enemy_num3,
type: "enemy_ship",
lifebar: 10,
lifebar: 15,
bullettype: 2,
isWrappable: true
}));
Expand Down Expand Up @@ -241,7 +241,7 @@ class Game {
//THIS DOES ALL THE WORK OF MOVING ALL THE OBJECTS BEFORE THE NEXT RENDER
moveObjects(delta, animationFrame) {
this.allObjects().forEach((object) => {
object.move(delta, animationFrame);
object.move(delta, animationFrame, this.ships[0].pos);
});
}

Expand All @@ -263,7 +263,7 @@ class Game {
x: 370,
y: 320,
size: "50px",
font: "PixelEmulator",
font: "Sans-Serif",
color: "red"
}
ctx.font = finished.size + " " + finished.font;
Expand All @@ -277,7 +277,7 @@ class Game {
x: 370,
y: 320,
size: "50px",
font: "PixelEmulator",
font: "Sans-Serif",
color: "white"
}
ctx.font = nxstage.size + " " + nxstage.font;
Expand All @@ -292,7 +292,7 @@ class Game {
this.clearScreen(ctx);
var imeg = new Image();
imeg.src = "assets/shooter_background.jpg";
ctx.drawImage(imeg,0,0,1250,650,0, 0,1250, 650);
ctx.drawImage(imeg,0,0,1240,620,0, 0,1240, 620);
this.drawText(this.ships[0].score, ctx);
// ctx.setTransform(0,1,1,0,1,1)
this.allObjects().forEach((object) => {
Expand Down Expand Up @@ -359,8 +359,8 @@ class Game {
}

Game.BG_COLOR = "#000000";
Game.DIM_X = 1250;
Game.DIM_Y = 650;
Game.DIM_X = 1240;
Game.DIM_Y = 620;
Game.FPS = 32;
Game.NUM_ENEMIES = 4;

Expand Down

0 comments on commit 3f38a3a

Please sign in to comment.