HTML and CSS Reference
In-Depth Information
this.add('animation');
this.bind('animEnd.fire',this,function() {
console.log("Fired!");
});
this.bind('animLoop.run_right',this,function() {
console.log("right");
});
this.bind('animLoop.run_left',this,function() {
console.log("left");
});
Q.input.bind('fire',this,"fire");
},
fire: function() {
this.play('fire',1);
},
step: function(dt) {
var p = this.p;
if(p.animation != 'fire') {
if(Q.inputs['right']) {
this.play('run_right');
p.x += p.speed * dt;
} else if(Q.inputs['left']) {
this.play('run_left');
p.x -= p.speed * dt;
} else {
this.play('stand');
}
}
this._super(dt);
}
});
Q.Block = Q.Sprite.extend({
init:function(props) {
this._super(_(props).extend({ sheet: 'woodbox' }));
}
});
Q.scene('level',new Q.Scene(function(stage) {
stage.insert(new Q.Player({ x:100, y:50, z:2 }));
stage.insert(new Q.Block({ x:800, y:160, z:1 }));
stage.insert(new Q.Block({ x:550, y:160, z:1 }));
}, { sort: true }));
Q.load(['sprites.png','sprites.json',,'background-floor.png',
'background-wall.png'],function() {
Search WWH ::




Custom Search