don't copy code for enemies
This commit is contained in:
parent
5ae5c8fbb6
commit
ed2ca44bd9
1 changed files with 26 additions and 53 deletions
|
@ -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) {
|
Q.Enemy.extend("Starbug",{
|
||||||
if(collision.obj.isA("Player")) {
|
|
||||||
this.destroy();
|
|
||||||
collision.obj.p.vy = -300;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// FIXME do not copy
|
|
||||||
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) {
|
Q.Enemy.extend("Martin",{
|
||||||
if(collision.obj.isA("Player")) {
|
|
||||||
this.destroy();
|
|
||||||
collision.obj.p.vy = -300;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// FIXME do not copy
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Reference in a new issue