0
我得到這個在game.js文件的頂部(從game.ts編譯)定義聲明:的Javascript =>遺漏的類型錯誤:未定義是不是一個函數
define(["require", "exports", "GameObjects"], function(require, exports, __GameObjects__) {
var GameObjects = __GameObjects__;
$(document).ready(function() {
var game = new Game();
$(document).keydown(game.onKeyDown);
$(document).keyup(game.onKeyUp);
$(document).keyup(game.onKeyUp);
});
function collides(a, b) {
與此錯誤:遺漏的類型錯誤:未定義是不是一個函數
從這個頁面:
<head>
<title>Space Demo</title>
<link href="/stylesheets/screen.css" media="all" rel="stylesheet" type="text/css" />
<script language="javascript" src="javascripts/require.js" type="text/javascript" data-main="ts/game.js"> </script>
<script language="javascript" src="javascripts/jquery-1.8.2.min.js" type="text/javascript"> </script>
</head>
什麼想法?
edit_ _ __ _ __ _ __ _ __ _ __ _
遊戲類是thegame.js文件
類遊戲{
// canvas: JQuery;
CANVAS_WIDTH: number = 400;
CANVAS_HEIGHT: number = 400;
FPS: number = 30;
enemies = [];
playerBullets: Array = new Array[40];
player: GameObjects.GameObjects.Player;
canvas: HTMLCanvasElement = <HTMLCanvasElement> document.getElementById('canvas');
context2D: CanvasRenderingContext2D;
constructor() {
// this.canvas = canvas;
this.context2D = this.canvas.getContext("2d");
this.canvas.width = this.CANVAS_WIDTH;
this.canvas.height = this.CANVAS_HEIGHT;
this.initGame();
}
對不起,但它在game.ts文件 – Nikos
看到編輯上面:) – Nikos