Archived
1
0
Fork 0

don't copy code for enemies

This commit is contained in:
neingeist 2013-11-25 12:51:20 +01:00
parent 5ae5c8fbb6
commit ed2ca44bd9

View file

@ -46,69 +46,42 @@ Q.Sprite.extend("Rocket", {
} }
}); });
Q.Sprite.extend("Neingeist",{ Q.Sprite.extend("Enemy", {
init: function(p, q) {
this._super(p, q);
this.add('2d, aiBounce');
this.on("bump.left,bump.right,bump.bottom",function(collision) {
if(collision.obj.isA("Player")) {
Q.stageScene("endGame", 1);
collision.obj.destroy();
}
});
this.on("bump.top",function(collision) {
if(collision.obj.isA("Player")) {
this.destroy();
collision.obj.p.vy = -300;
}
});
}
});
Q.Enemy.extend("Neingeist",{
init: function(p) { init: function(p) {
this._super(p, { sheet: 'neingeist', vx: 100 }); this._super(p, { sheet: 'neingeist', vx: 100 });
this.add('2d, aiBounce');
this.on("bump.left,bump.right,bump.bottom",function(collision) {
if(collision.obj.isA("Player")) {
Q.stageScene("endGame", 1);
collision.obj.destroy();
}
});
this.on("bump.top",function(collision) {
if(collision.obj.isA("Player")) {
this.destroy();
collision.obj.p.vy = -300;
}
});
} }
}); });
// FIXME do not copy Q.Enemy.extend("Starbug",{
Q.Sprite.extend("Starbug",{
init: function(p) { init: function(p) {
this._super(p, { sheet: 'starbug', vx: 100 }); this._super(p, { sheet: 'starbug', vx: 90 });
this.add('2d, aiBounce');
this.on("bump.left,bump.right,bump.bottom",function(collision) {
if(collision.obj.isA("Player")) {
Q.stageScene("endGame", 1);
collision.obj.destroy();
}
});
this.on("bump.top",function(collision) {
if(collision.obj.isA("Player")) {
this.destroy();
collision.obj.p.vy = -300;
}
});
} }
}); });
// FIXME do not copy Q.Enemy.extend("Martin",{
Q.Sprite.extend("Martin",{
init: function(p) { init: function(p) {
this._super(p, { sheet: 'martin', vx: 100 }); this._super(p, { sheet: 'martin', vx: 80 });
this.add('2d, aiBounce');
this.on("bump.left,bump.right,bump.bottom",function(collision) {
if(collision.obj.isA("Player")) {
Q.stageScene("endGame", 1);
collision.obj.destroy();
}
});
this.on("bump.top",function(collision) {
if(collision.obj.isA("Player")) {
this.destroy();
collision.obj.p.vy = -300;
}
});
} }
}); });