我试图将硬币合并到master中,但存在冲突。我无法挽救比赛。js文件,或者因为sublime对我大喊大叫,因为我有一个语法错误,我无法理解,请帮助
enter image description here
// Canvas Asteroids
//
// Copyright (c) 2010 Doug McInnes
//
KEY_CODES = {
'32': 'space',
'37': 'left',
'38': 'up',
'39': 'right',
'40': 'down',
'70': 'f',
'71': 'g',
'72': 'h',
'77': 'm',
'80': 'p'
}
KEY_STATUS = { keyDown:false };
for (code in KEY_CODES) {
KEY_STATUS[KEY_CODES[code]] = false;
}
$(window).keydown(function (e) {
KEY_STATUS.keyDown = true;
if (KEY_CODES[e.keyCode]) {
e.preventDefault();
KEY_STATUS[KEY_CODES[e.keyCode]] = true;
}
}).keyup(function (e) {
KEY_STATUS.keyDown = false;
if (KEY_CODES[e.keyCode]) {
e.preventDefault();
KEY_STATUS[KEY_CODES[e.keyCode]] = false;
}
});
GRID_SIZE = 60;
Matrix = function (rows, columns) {
var i, j;
this.data = new Array(rows);
for (i = 0; i < rows; i++) {
this.data[i] = new Array(columns);
}
this.configure = function (rot, scale, transx, transy) {
var rad = (rot * Math.PI)/180;
var sin = Math.sin(rad) * scale;
var cos = Math.cos(rad) * scale;
this.set(cos, -sin, transx,
sin, cos, transy);
};
this.set = function () {
var k = 0;
for (i = 0; i < rows; i++) {
for (j = 0; j < columns; j++) {
this.data[i][j] = arguments[k];
k++;
}
}
}
this.multiply = function () {
var vector = new Array(rows);
for (i = 0; i < rows; i++) {
vector[i] = 0;
for (j = 0; j < columns; j++) {
vector[i] += this.data[i][j] * arguments[j];
}
}
return vector;
};
};
Sprite = function () {
this.init = function (name, points) {
this.name = name;
this.points = points;
this.vel = {
x: 0,
y: 0,
rot: 0
};
this.acc = {
x: 0,
y: 0,
rot: 0
};
};
this.children = {};
this.color = 'black';
this.solid = false;
this.visible = false;
this.reap = false;
this.bridgesH = true;
this.bridgesV = true;
this.collidesWith = [];
this.x = 0;
this.y = 0;
this.rot = 0;
this.scale = 1;
this.currentNode = null;
this.nextSprite = null;
this.preMove = null;
this.postMove = null;
this.run = function(delta) {
this.move(delta);
this.updateGrid();
this.context.save();
this.configureTransform();
this.draw();
var canidates = this.findCollisionCanidates();
this.matrix.configure(this.rot, this.scale, this.x, this.y);
this.checkCollisionsAgainst(canidates);
this.context.restore();
if (this.bridgesH && this.currentNode && this.currentNode.dupe.horizontal) {
this.x += this.currentNode.dupe.horizontal;
this.context.save();
this.configureTransform();
this.draw();
this.checkCollisionsAgainst(canidates);
this.context.restore();
if (this.currentNode) {
this.x -= this.currentNode.dupe.horizontal;
}
}
if (this.bridgesV && this.currentNode && this.currentNode.dupe.vertical) {
this.y += this.currentNode.dupe.vertical;
this.context.save();
this.configureTransform();
this.draw();
this.checkCollisionsAgainst(canidates);
this.context.restore();
if (this.currentNode) {
this.y -= this.currentNode.dupe.vertical;
}
}
if (this.bridgesH && this.bridgesV &&
this.currentNode &&
this.currentNode.dupe.vertical &&
this.currentNode.dupe.horizontal) {
this.x += this.currentNode.dupe.horizontal;
this.y += this.currentNode.dupe.vertical;
this.context.save();
this.configureTransform();
this.draw();
this.checkCollisionsAgainst(canidates);
this.context.restore();
if (this.currentNode) {
this.x -= this.currentNode.dupe.horizontal;
this.y -= this.currentNode.dupe.vertical;
}
}
};
this.move = function (delta) {
if (!this.visible) return;
this.transPoints = null; // clear cached points
if ($.isFunction(this.preMove)) {
this.preMove(delta);
}