1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Chrome 恐竜ゲームをチートするスニペット (2026年5月版)

1
Last updated at Posted at 2026-05-05

Chrome 恐竜ゲーム (Chrome のアドレスバーに chrome://dino/ と入力すると遊べるゲーム) をチートしようとして Web で調べたスニペットをコンソールに入力したら、Uncaught TypeError: Cannot read properties of undefined (reading 'setSpeed') のようなエラーが出ることがあると思います。
なので、現時点 (2026 年 5 月) の Chrome で動作するスニペットを記します。
なお、ゲームのインスタンスを Runner.instance_ でなく Runner.getInstance() で取るようにするだけです。

参考文献

  • 【Chrome】"恐竜ゲーム"チート集🦖🌵 - Qiita - 元記事です。
    • 本記事は上記の元記事の instance_ を getInstance() にしただけです。ただし、レーザーについては設定値変更というより機能追加なので本記事では Runner のプロトタイプへのメソッド追加にしました。また、不死身化は元々 gameOver メソッドのオーバーライドで実現するので元記事と同じです。
  • Chrome Dino game cheats - GitHub Gist ですが恐竜ゲームのチートに関するフォーラムになっています。上記の元記事から参照されています。

スニペット

恐竜ゲーム画面でデベロッパーツールを開き、Console タブに下記スニペットを打ち込んでエンターキーを押すと有効になります。なお、デベロッパーツールはデフォルトでコードのペーストを許可していないので、ペーストを許可したい場合は allow paste と打つ必要があります (ペーストを試みるとそのように表示されます)。

恐竜の進むスピードを遅くする
Runner.getInstance().setSpeed(1);
上空に浮き上がることで障害物をスルーする
Runner.getInstance().tRex.groundYPos = 10;
逆に地下に潜ることで障害物をスルーする
Runner.getInstance().tRex.groundYPos = 140;
不死身 (ゲームオーバーにならない)
Runner.prototype.gameOver = () => {};
Dボタンでレーザーを撃つ (Runner のプロトタイプにメソッドとして追加する版)
Runner.prototype.shootLaser = function() {
  if (!this.horizon?.obstacles?.length) return;
  const originalClearCanvas = this.clearCanvas;
  this.clearCanvas = () => {};
  const obs = this.horizon.obstacles[0];
  this.canvasCtx.beginPath();
  this.canvasCtx.moveTo(this.tRex.xPos + 23, this.tRex.yPos + 20);
  this.canvasCtx.lineTo(obs.xPos + 10, obs.yPos + 10);
  this.canvasCtx.stroke();
  setTimeout(() => { this.clearCanvas = originalClearCanvas; }, 15);
  this.horizon.removeFirstObstacle();
};
const originalOnKeyDown = Runner.prototype.onKeyDown;
Runner.prototype.onKeyDown = function(event) {
  if (event.code === 'KeyD') { this.shootLaser(); return; }
  return originalOnKeyDown.call(this, event);
};

ちなみに、手元でレーザーを太くしてみましたが細いままの方が見た目がよかったです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?