-1
我有这样的源代码:JavaScript函数游戏
var Game = function() {
var canvas = document.getElementById('world');
this.context = canvas.getContext('2d');
我使用了一些函数来处理这个类:
Game.prototype.updateAll = function() {...}
和一些其他功能。
现在我想使用鼠标功能(点击右,左......)
我觉得是需要在我的游戏类类似的东西补充:
this.canvas.addEventListener("click", this.getmouse, false);
但是浏览器不要” t给我什么东西...
如何以及在哪里可以在我的班级做这个功能?
您是否定义了'Game.prototype.getmouse'? – Alnitak