Class Javascript调用原型方法

Class Javascript调用原型方法,class,methods,prototype,phaser-framework,Class,Methods,Prototype,Phaser Framework,为什么我不能使用这个.prepareToJump()?你不喜欢使用它 var newGame = {}; newGame.Game.prototype = { prepareToJump: function() { if (ninja.body.velocity.y == 0) { powerBar = game.add.sprite(ninja.x, ninja.y - 50, "powerbar"); powerBar.width = 0; powerTween = game.

为什么我不能使用
这个.prepareToJump()

你不喜欢使用它

var newGame = {};
newGame.Game.prototype =  {
prepareToJump: function() {
if (ninja.body.velocity.y == 0) {
  powerBar = game.add.sprite(ninja.x, ninja.y - 50, "powerbar");
  powerBar.width = 0;
  powerTween = game.add.tween(powerBar).to({
    width: 100
  }, 1000, "Linear", true);
  game.input.onDown.remove(newGame.Game.prototype.prepareToJump, this);
  game.input.onUp.add(newGame.Game.prototype.jump, this);
}

},
jump: function() {
this.prepareToJump(); // undefinded
//but we can use newGame.Game.prototype.prepareToJump();
}
}
但是像这样,因为它在构造函数内部

this.prepareToJump()

感谢您的回答:)的可能副本
this.prepareToJump