Merge pull request #3 from NameWjp/patch-2

简化 getItemsByType 方法
This commit is contained in:
PASSER-BY authored and GitHub committed 2021-03-31 17:47:55 +08:00
commit ed97bc2232
2 files changed
+2 -4

No files matched your search

+1 -3
View File
@@ -266,9 +266,7 @@ function Game(id,params){
//获取对象列表
Stage.prototype.getItemsByType = function(type){
return this.items.filter(function(item){
if(item.type==type){
return item;
}
return item.type == type;
});
};
//添加地图
+1 -1
View File
@@ -926,7 +926,7 @@
update:function(){
var coord = this.coord;
if(!coord.offset){
if(this.control.orientation!='undefined'){
if(typeof this.control.orientation != 'undefined'){
if(!map.get(coord.x+_COS[this.control.orientation],coord.y+_SIN[this.control.orientation])){
this.orientation = this.control.orientation;
}