Skip to content

Commit

Permalink
egg ammo
Browse files Browse the repository at this point in the history
  • Loading branch information
severest committed Nov 25, 2012
1 parent cd621b9 commit a912343
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions components.js
Expand Up @@ -20,13 +20,17 @@ Crafty.c("HurtForky" , {
}
});
Crafty.c("StraightBullets", {
setSpeed: function(speedX, speedY) {

setSpeed: function(speedX, speedY, rot) {
this.bind('EnterFrame', function () {
this.y += speedY;
this.x += speedX;
this.rotation += rot;
if (this.y > STAGE_HEIGHT || this.y < (0-this.h) || this.x < (0-this.w) || this.x > STAGE_WIDTH)
this.destroy();
});

return this;
}
});
Crafty.c("LockingMissles", {
Expand Down Expand Up @@ -61,7 +65,9 @@ Crafty.c("LockingMissles", {

if (this.y > STAGE_HEIGHT || this.y < 0 || this.x < 0 || this.x > STAGE_WIDTH)
this.destroy();

});
return this;
}
});

Expand Down Expand Up @@ -110,10 +116,12 @@ Crafty.c("SimpleEnemy", {
},

fireWeapon: function() {
Crafty.e("Bullet, 2D, DOM, Image, StraightBullets, HurtForky")
.image("imgs/bullet.png")
Crafty.e("Bullet, 2D, DOM, eggbullet, SpriteAnimation, StraightBullets, HurtForky")
.animate("go", 0, 0, 4)
.animate("go", 20, -1)
.attr({ x: this.x, y: this.y, z: 4})
.setSpeed(0,5);
.setSpeed(0,5,2)
.origin("center");
this.realDelay(this.fireWeapon, 1000);
}
});
Expand Down
2 changes: 1 addition & 1 deletion game.js
Expand Up @@ -16,7 +16,7 @@ window.onload = function () {
Crafty.sprite(20, 80, "imgs/bacon2.png", {firebacon:[0,0]});
Crafty.sprite(120, "imgs/burger_sheet.png", {burg:[0,0]});
Crafty.sprite(100,91, "imgs/egg_ss.png", {egg:[0,0]});
Crafty.sprite(100,91, "imgs/eggbullet.png", {eggbullet:[0,0]});
Crafty.sprite(40,50, "imgs/eggbullet.png", {eggbullet:[0,0]});
Crafty.sprite(80,71, "imgs/onion_ss.png", {onion:[0,0]});
Crafty.sprite(100, "imgs/fireball.png", {fireball:[0,0]});
Crafty.sprite(39,36, "imgs/peppermint.png", {peppermint:[0,0]});
Expand Down
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -2,6 +2,7 @@
<head>
<script type="text/javascript" src="js/crafty-min.js"></script>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="game.js"></script>
<script type="text/javascript" src="components.js"></script>
<script type="text/javascript" src="js/realDelay.js"></script>
Expand Down

0 comments on commit a912343

Please sign in to comment.