シンプルな昔ながらのマリオ クローンのために私が取り組んできたこの JavaScript コードを誰かが見てくれることを願っています。いくつかのチュートリアルからキャンバスについて知っていることをまとめましたが、ブロックとの衝突やジャンプが正しく機能していません。
ジャンプは、マリオを何度も何度もバウンドさせる無限ループに設定しているように見えます。
       function Player() {
     this.srcX = 0;
     this.srcY = 0;
     this.drawX = gameWidth /2;
     this.drawY = 0;
     this.scaleWidth = 38;
     this.scaleHeight = 50;
     this.width = 48;
     this.height = 60;
     this.speed = 10;
     this.maxJump = 50;
     this.velY = 0;
     this.velX = 0;
     this.isJumpKey = false;
     this.isRightKey = false;
     this.isCrouchKey = false;
     this.isLeftKey = false;
     this.jumping = false;
     this.grounded = false;
    }
    Player.prototype.draw = function(){
      clearPlayer();
      this.checkKeys();
      ctxPlayer.drawImage(
        player,
        this.srcX,
        this.srcY,
        this.width,
        this.height,
        this.drawX,
        this.drawY,
        this.scaleWidth,
        this.scaleHeight);
    };
Player.prototype.checkKeys = function () {
 if(this.isJumpKey){
    if (!this.jumping && this.grounded ) {
        this.jumping = true;
        this.grounded = false;
        this.velY = -this.speed * 2;
    }
 }
 if(this.isRightKey){
   if (this.velX < this.speed) {
            this.velX++;
        }
 }
  if(this.isLeftKey){
  if (this.velX < this.speed) {
            this.velX--;
        }
 }
 if(this.isCrouchKey){
      player1.grounded = true;
      player1.jumping = false;
}
};
ここに私が今いるコードペンがあります:http://codepen.io/AlexBezuska/pen/ysJcI
私は本当に助けに感謝します、私はそれまでの間これを検索して遊んでいきますが、あなたが与えることができるポインタ、書式設定、プロトタイプ作成などの提案さえも本当に感謝しています(私はキャンバスとプロトタイプの両方にまったく慣れていません)