ブーストボタン大型化・半透明化
by
cutfloss
05/14 [2026/05/14 15:02:20]
スマホで押しにくいブーストボタンを大きくするぞ!
-
/*
* @title ブーストボタン大型化・半透明化
* @description スマホで押しにくいブーストボタンを大きくするぞ!
* @private
*/
javascript:(function(){
/* 1. 描画ロジックの書き換え(見た目を大きく・半透明に) */
const originalDrawBoostGauge = window.drawBoostGauge;
window.drawBoostGauge = function(ctx) {
/* カメさんモードやゴースト状態なら表示しない(原作の安全策を維持) */
if (typeof turtleMode !== 'undefined' && turtleMode) return;
const me = players.find(p => p.id === myId);
if (me && (me.isGhost || me.state === 'ghost')) return;
/* ボタンのサイズ設定(元の140x36から260x80へ大幅アップ!) */
const gW = 300;
const gH = 100;
const gX = (window.innerWidth - gW) / 2;
const gY = window.innerHeight - 120;
ctx.save();
/* 全体の透明度を下げてマップを透けさせる */
ctx.globalAlpha = 0.4;
/* ボタンの背景描画(ジェット/ブースト/チャージ/冷却を判定) */
let color1 = '#66ff66', color2 = '#22cc22'; /* 通常 */
let label = '⚡ BOOST';
if (typeof machBoosting !== 'undefined' && machBoosting) {
color1 = '#ff4400'; color2 = '#ffaa00'; label = '🚀 JET!!';
} else if (typeof boostRemainingMs !== 'undefined' && boostRemainingMs > 0) {
color1 = '#ffff00'; color2 = '#ffaa00'; label = '⚡ ACTIVE';
} else if (typeof boostCooldownSec !== 'undefined' && boostCooldownSec > 0) {
color1 = '#444'; color2 = '#222'; label = boostCooldownSec + 's';
} else if (typeof jetChargeSec !== 'undefined' && jetChargeSec >= 20) {
color1 = '#ffaa00'; color2 = '#ff6600'; label = '🚀 JET READY';
}
const grad = ctx.createLinearGradient(gX, gY, gX, gY + gH);
grad.addColorStop(0, color1);
grad.addColorStop(1, color2);
ctx.fillStyle = grad;
/* 角丸の巨大ボタンを描画 */
if (ctx.roundRect) {
ctx.beginPath();
ctx.roundRect(gX, gY, gW, gH, 20);
ctx.fill();
} else {
ctx.fillRect(gX, gY, gW, gH);
}
/* 文字の描画(さらにクッキリ) */
ctx.globalAlpha = 0.9;
ctx.fillStyle = '#ffffff';
ctx.font = 'bold 24px sans-serif';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText(label, gX + gW / 2, gY + gH / 2);
ctx.restore();
};
/* 2. タップ判定ロジックの書き換え(押しやすくする) */
window.isInBoostButtonArea = function(x, y) {
const gW = 260;
const gH = 120; /* 判定は描画よりさらに下に広げて、画面下部を適当に叩いても反応するように */
const gX = (window.innerWidth - gW) / 2;
const gY = window.innerHeight - 130;
return x >= gX && x <= gX + gW && y >= gY && y <= gY + gH;
};
})();
-
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。