Javascript Shortcode Area
-----Version 110606-----
 asdf-j3 

<body bgcolor=black text=white onKeyDown="K=event.keyCode-37">
<tt id=F style="font-size: 200%;">
<script>
// オリジナルのJavaScriptコード (関数 R, I, ccc, Y, YY) は変更なし
function R(H){while(D.all["F"+(S=40+Math.ceil(ccc(i)*319))].innerHTML!=C);I(S,H)}
function I(T,H){D.all["F"+T].innerHTML=H}
function ccc(cc){j=j+1;a=Math.sin((cc+0.1+j/100)/24);a=""+a;b=a.slice(-8,-2);a=eval(b)/1000000;return a}

function Y(){if(K+1){M=[-1,0,1,0][K];}Z=P;P=P+M;
X=D.all["F"+P].innerHTML;P2=P+20;XX=D.all["F"+P2].innerHTML;
if(XX==C && M==0){P=P+20;}
if(X==O || XX==O){alert("GAME OVER SCORE: "+SC*10);return}
if(X==T || XX==T){KY=1;Q="<font color=\"Purple\" style=\"font-size: inherit;\">●</font>";P=P+20;}
if(X==U || XX==U){if(KY==1){SC++;YY();}else{P=P-20;}}
if(X==W){P=P-M;}
if(X==N || XX==N){P=P-(20*6);while(P<0){P=P+20;}
while(C!=D.all["F"+P].innerHTML){P=P-20;} }
I(Z,C);I(P,Q);K=-1;M=0;ID=setTimeout(Y,100); }

function YY(){D=document;M=0;P=370;S="";K=-1;P2=0;C=" ";
U="<font color=\"Lime\" style=\"font-size: inherit;\">門</font>";
Q="<font color=\"blue\" style=\"font-size: inherit;\">●</font>";
W="<font color=\"Maroon\" style=\"font-size: inherit;\">■</font>";
N="<font color=\"aqua\" style=\"font-size: inherit;\">=</font>";
O="<font color=\"white\" style=\"font-size: inherit;\">*</font>";
T="<font color=\"yellow\" style=\"font-size: inherit;\">ー</font>";
E="<INPUT TYPE=\"button\" VALUE=\"☆\" STYLE=\"font-size: inherit;\" ONCLICK=\"clearTimeout(ID);YYY()\">";
for(i=0;i<400;i++)
S+=(i%20?"":"<br>")+"<span id=F"+i+">"+((i+1)%20>1&&i<379?C:W)+"</span>";I("",S);
for(i=0;i<51;i++)I(20+Math.ceil(ccc(i)*339),W);for(i=0;i<11;i++)R(N);I(399,E);
for(i=0;i<(2+SC);i++)R(O);for(i=0;i<2;i++)I(Math.ceil(360+ccc(i)*18),N);R(U);R(T);KY=0; }

function YYY(){
j=0;SC=0;
YY();
setupTouchControls();
Y();
}

function setupTouchControls() {
let controlsDiv = document.getElementById('touchControls');
if (!controlsDiv) {
controlsDiv = document.createElement('div');
controlsDiv.id = 'touchControls';
controlsDiv.style.position = 'fixed';
controlsDiv.style.bottom = '60px';
controlsDiv.style.left = '50%';
controlsDiv.style.transform = 'translateX(-50%)';
controlsDiv.style.zIndex = '1000';
controlsDiv.style.textAlign = 'center';

// {タンのHTMLを生成 (左右{タンのみ、サイズを大きくする)
// min-width は 220px (ユーザーの要望で半分にした状態) を維持
controlsDiv.innerHTML = `
<div>
<button id="btnLeft" style="padding: 40px 70px; margin: 10px; font-size: 96px; min-width: 220px;">←</button>
<button id="btnRight" style="padding: 40px 70px; margin: 10px; font-size: 96px; min-width: 220px;">→</button>
</div>
`;
document.body.appendChild(controlsDiv);
}

document.getElementById('btnLeft').onclick = function() { K = 0; };
document.getElementById('btnRight').onclick = function() { K = 2; };
}

// ★変更点: ダブルタップによる拡大を防ぐ処理
let lastTouchEnd = 0;
document.documentElement.addEventListener('touchend', function (event) {
const now = (new Date()).getTime();
if (now - lastTouchEnd <= 300) { // 300ミリ秒以内に2回目のtouch終了があればダブルタップとみなす
event.preventDefault();
}
lastTouchEnd = now;
}, { passive: false }); // passive: false で preventDefault を有効に

// ゲーム開始
YYY();
</script>
</tt>
</body>


使用変数

-------( Function )
a
b
bgcolor
bottom
C
ccc -------( Function )
color
controlsDiv
D
E
I -------( Function )
i
id
ID
innerHTML
j
K
KY
lastTouchEnd
left
M
N
now
O
ONCLICK
onclick
onKeyDown
P2
P
position
Q
R -------( Function )
S
SC
setupTouchControls -------( Function )
style
STYLE
T
text
textAlign
transform
TYPE
U
VALUE
W
X
XX
Y -------( Function )
YY -------( Function )
YYY -------( Function )
Z
zIndex