Merge branch 'master' of https://github.com/mumuy/pacman
This commit is contained in:
commit
865a2ff6c5
4
game.js
4
game.js
@ -84,7 +84,6 @@ function Game(id,params){
|
||||
Item.prototype.bind = function(eventType,callback){
|
||||
if(!_events[eventType]){
|
||||
_events[eventType] = {};
|
||||
}
|
||||
$canvas.addEventListener(eventType,function(e){
|
||||
var position = _.getPosition(e);
|
||||
_stages[_index].items.forEach(function(item){
|
||||
@ -97,6 +96,7 @@ function Game(id,params){
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
_events[eventType]['s'+this._stage.index+'i'+this._id] = callback.bind(this); //绑定作用域
|
||||
};
|
||||
//地图对象构造器
|
||||
@ -310,7 +310,6 @@ function Game(id,params){
|
||||
Stage.prototype.bind = function(eventType,callback){
|
||||
if(!_events[eventType]){
|
||||
_events[eventType] = {};
|
||||
}
|
||||
window.addEventListener(eventType,function(e){
|
||||
var key = 's' + _index;
|
||||
if(_events[eventType][key]){
|
||||
@ -318,6 +317,7 @@ function Game(id,params){
|
||||
}
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
_events[eventType]['s'+this.index] = callback.bind(this); //绑定事件作用域
|
||||
};
|
||||
//动画开始
|
||||
|
Loading…
x
Reference in New Issue
Block a user