setInterval(fn,t);里的fn中,要使用外部类的this,则需要先将this保存起来,再使用保存的this,不能直接使用this,里面的this是指向window对象,记住setInterval()实际上是window.setInterval()就明白了. //这是Hero类中的一个方法 Hero.prototype.shotEnemy=function(){ switch(this.direct){ case 0: var bullet=new Bullet(this.x+9,t