remove extra whitespace
This commit is contained in:
parent
988ace1d33
commit
16a5585310
1 changed files with 15 additions and 14 deletions
|
@ -5,7 +5,7 @@
|
|||
// as it loads a level json file.
|
||||
//
|
||||
// This is the example from the website homepage, it consists
|
||||
// a simple, non-animated platformer with some enemies and a
|
||||
// a simple, non-animated platformer with some enemies and a
|
||||
// target for the player.
|
||||
window.addEventListener("load",function() {
|
||||
|
||||
|
@ -72,15 +72,15 @@ Q.Sprite.extend("Neingeist",{
|
|||
init: function(p) {
|
||||
this._super(p, { sheet: 'neingeist', vx: 100 });
|
||||
|
||||
// Enemies use the Bounce AI to change direction
|
||||
// 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: "You Died" });
|
||||
if(collision.obj.isA("Player")) {
|
||||
Q.stageScene("endGame",1, { label: "You Died" });
|
||||
collision.obj.destroy();
|
||||
}
|
||||
});
|
||||
|
@ -88,7 +88,7 @@ Q.Sprite.extend("Neingeist",{
|
|||
// 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")) {
|
||||
if(collision.obj.isA("Player")) {
|
||||
this.destroy();
|
||||
collision.obj.p.vy = -300;
|
||||
}
|
||||
|
@ -104,15 +104,15 @@ Q.Sprite.extend("Starbug",{
|
|||
init: function(p) {
|
||||
this._super(p, { sheet: 'starbug', vx: 100 });
|
||||
|
||||
// Enemies use the Bounce AI to change direction
|
||||
// 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: "You Died" });
|
||||
if(collision.obj.isA("Player")) {
|
||||
Q.stageScene("endGame",1, { label: "You Died" });
|
||||
collision.obj.destroy();
|
||||
}
|
||||
});
|
||||
|
@ -120,7 +120,7 @@ Q.Sprite.extend("Starbug",{
|
|||
// 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")) {
|
||||
if(collision.obj.isA("Player")) {
|
||||
this.destroy();
|
||||
collision.obj.p.vy = -300;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ Q.scene("level1",function(stage) {
|
|||
stage.insert(new Q.Cake({ x: 146, y: 36 }));
|
||||
});
|
||||
|
||||
// To display a game over / game won popup box,
|
||||
// To display a game over / game won popup box,
|
||||
// create a endGame scene that takes in a `label` option
|
||||
// to control the displayed message.
|
||||
Q.scene('endGame',function(stage) {
|
||||
|
@ -167,9 +167,10 @@ Q.scene('endGame',function(stage) {
|
|||
x: Q.width/2, y: Q.height/2, fill: "rgba(0,0,0,0.5)"
|
||||
}));
|
||||
|
||||
|
||||
var button = container.insert(new Q.UI.Button({ x: 0, y: 0, fill: "#CCCCCC",
|
||||
label: "Play Again" }))
|
||||
var label = container.insert(new Q.UI.Text({x:10, y: -10 - button.p.h,
|
||||
label: "Play Again" }))
|
||||
var label = container.insert(new Q.UI.Text({x:10, y: -10 - button.p.h,
|
||||
label: stage.options.label }));
|
||||
// When the button is clicked, clear all the stages
|
||||
// and restart the game.
|
||||
|
@ -222,9 +223,9 @@ Q.load("sprites.png, sprites.json, level.json, tiles.png, background.png", funct
|
|||
});
|
||||
|
||||
// ## Possible Experimentations:
|
||||
//
|
||||
//
|
||||
// The are lots of things to try out here.
|
||||
//
|
||||
//
|
||||
// 1. Modify level.json to change the level around and add in some more enemies.
|
||||
// 2. Add in a second level by creating a level2.json and a level2 scene that gets
|
||||
// loaded after level 1 is complete.
|
||||
|
|
Reference in a new issue