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