2017-06-28 8 views
-1

コインをマスターにマージしようとしていますが、競合があります。崇高は、私が把握することはできません構文エラーを持つために私に叫んされているので、私は、ここに enter image description here識別子が必要で、代わりに '*'行が表示される7 pos 3

を助けてくださいは、崇高なテキスト3あたりとしてバグを持つすべてのコードですgame.jsファイルを保存することができませんどちらか:

// 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); 
    } 
+0

2つの質問があります。まず構文エラーを修正してください。 –

+0

あなたの質問にテキストとしてコードを含めてください。コードの画像はお勧めできません。 –

+0

昨日はすべてうまくいっていましたが、崇高なテキスト3エディタをカスタマイズして、たくさんのパッケージを追加しました。 JSlint ESlintなどです。今私はより多くの問題に遭遇しました、以下のコードをご覧ください: – oalbacha

答えて

0

@torazaburoありがとうございました。 JSLintは、すべて

@torazaburo私は崇高なテキストからパッケージを削除3.

を働いていた問題は、プロパティ名と同じように動作するはずでした。これは、よく知られているように、 JSLintのバグだと思われます。

関連する問題