neingeist
/
cosmos
Archived
1
0
Fork 0

add martin as enemy

master
neingeist 11 years ago
parent a07db2f7f2
commit 62f34ba512

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -1 +1 @@
{"astronaut":{"sx":0,"sy":1,"cols":1,"tilew":24,"tileh":24,"frames":1},"neingeist":{"sx":0,"sy":26,"cols":1,"tilew":24,"tileh":24,"frames":1},"rocket":{"sx":0,"sy":51,"cols":1,"tilew":26,"tileh":52,"frames":1},"starbug":{"sx":0,"sy":104,"cols":1,"tilew":24,"tileh":24,"frames":1}}
{"astronaut":{"sx":0,"sy":1,"cols":1,"tilew":24,"tileh":24,"frames":1},"martin":{"sx":0,"sy":26,"cols":1,"tilew":24,"tileh":24,"frames":1},"neingeist":{"sx":0,"sy":51,"cols":1,"tilew":24,"tileh":24,"frames":1},"rocket":{"sx":0,"sy":76,"cols":1,"tilew":26,"tileh":52,"frames":1},"starbug":{"sx":0,"sy":129,"cols":1,"tilew":24,"tileh":24,"frames":1}}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

@ -94,7 +94,6 @@ Q.Sprite.extend("Neingeist",{
}
});
// FIXME do not copy
// ## Enemy Sprite
// Create the Enemy class to add in some baddies
@ -126,6 +125,37 @@ Q.Sprite.extend("Starbug",{
}
});
// FIXME do not copy
// ## Enemy Sprite
// Create the Enemy class to add in some baddies
Q.Sprite.extend("Martin",{
init: function(p) {
this._super(p, { sheet: 'martin', vx: 100 });
// Enemies use the Bounce AI to change direction
// whenver they run into something.
this.add('2d, aiBounce');
// Listen for a sprite collision, if it's the player,
// end the game unless the enemy is hit on top
this.on("bump.left,bump.right,bump.bottom",function(collision) {
if(collision.obj.isA("Player")) {
Q.stageScene("endGame",1, { label: "DU BIST TOT" });
collision.obj.destroy();
}
});
// If the enemy gets hit on the top, destroy it
// and give the user a "hop"
this.on("bump.top",function(collision) {
if(collision.obj.isA("Player")) {
this.destroy();
collision.obj.p.vy = -300;
}
});
}
});
// ## Level1 scene
// Create a new scene called level 1
Q.scene("level1",function(stage) {
@ -152,6 +182,7 @@ Q.scene("level1",function(stage) {
// Add in a couple of enemies
stage.insert(new Q.Starbug({ x: 600, y: 0 }));
stage.insert(new Q.Neingeist({ x: 650, y: 0 }));
stage.insert(new Q.Martin({ x: 550, y: 0 }));
stage.insert(new Q.Rocket({ x: 146, y: 32 }));
});