neingeist
/
cosmos
Archived
1
0
Fork 0

don't copy code for enemies

master
neingeist 11 years ago
parent 5ae5c8fbb6
commit ed2ca44bd9

@ -46,9 +46,9 @@ Q.Sprite.extend("Rocket", {
} }
}); });
Q.Sprite.extend("Neingeist",{ Q.Sprite.extend("Enemy", {
init: function(p) { init: function(p, q) {
this._super(p, { sheet: 'neingeist', vx: 100 }); this._super(p, q);
this.add('2d, aiBounce'); this.add('2d, aiBounce');
this.on("bump.left,bump.right,bump.bottom",function(collision) { this.on("bump.left,bump.right,bump.bottom",function(collision) {
@ -67,48 +67,21 @@ Q.Sprite.extend("Neingeist",{
} }
}); });
// FIXME do not copy Q.Enemy.extend("Neingeist",{
Q.Sprite.extend("Starbug",{
init: function(p) { init: function(p) {
this._super(p, { sheet: 'starbug', 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("Martin",{
init: function(p) { init: function(p) {
this._super(p, { sheet: 'martin', 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) { Q.Enemy.extend("Martin",{
if(collision.obj.isA("Player")) { init: function(p) {
this.destroy(); this._super(p, { sheet: 'martin', vx: 80 });
collision.obj.p.vy = -300;
}
});
} }
}); });