Add tank stage 6: mirrors and a raid on the enemy base
Five stages of holding the line; this one lets you attack. An enemy eagle sits at the top behind steel, and a player shell that reaches it ends the stage at once for 1000 - enemy shells cannot touch it, so the stage cannot clear itself. Reaching it needs the mirrors. A shell entering one turns 90 degrees, capped at five turns and stepped one cell past the mirror so it cannot re-enter the same one. The eagle's only opening is a bullet-only shaft at column 8, walled in steel and fed by a "/" mirror below it, so only a shot travelling right along row 6 banks up into it; shooting left or from underneath deflects away. Mirrors block tanks and cannot be broken, and they block the enemies' line of sight so they do not waste shots. The clear/win paths were one block inside afterKill; they are now clearStage(bonus, note) so the snipe and the last kill share them. Checked headlessly: the snipe lands and pays 1000, the shaft saw 0 tank samples against 639 bullet samples, 6 idle runs left the enemy eagle standing, and closing r11's centre brought the base through 6 of 10 idle runs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -176,6 +176,7 @@ body{
|
||||
<a href="tank.html#3" target="stage" data-key="tank3" title="3단계 강철 회랑">3단계</a>
|
||||
<a href="tank.html#4" target="stage" data-key="tank4" title="4단계 참호 — 물길·보급 상자">4단계</a>
|
||||
<a href="tank.html#5" target="stage" data-key="tank5" title="5단계 최후 방어선 — 숲·지휘 탱크">5단계</a>
|
||||
<a href="tank.html#6" target="stage" data-key="tank6" title="6단계 거울 요새 — 반사판·적 본진 습격">6단계</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -203,7 +204,8 @@ var PAGES = {
|
||||
tank2: {file:'tank.html#2', name:'휴게실 · 탱크게임 2단계'},
|
||||
tank3: {file:'tank.html#3', name:'휴게실 · 탱크게임 3단계'},
|
||||
tank4: {file:'tank.html#4', name:'휴게실 · 탱크게임 4단계'},
|
||||
tank5: {file:'tank.html#5', name:'휴게실 · 탱크게임 5단계'}
|
||||
tank5: {file:'tank.html#5', name:'휴게실 · 탱크게임 5단계'},
|
||||
tank6: {file:'tank.html#6', name:'휴게실 · 탱크게임 6단계'}
|
||||
};
|
||||
var DEFAULT = 'korean';
|
||||
|
||||
|
||||
+131
-23
@@ -83,9 +83,10 @@
|
||||
}
|
||||
button:hover{filter:brightness(1.1)}
|
||||
button:active{transform:translateY(1px); border-bottom-width:2px}
|
||||
.btns{display:flex; gap:4px; margin-top:10px}
|
||||
.btns{display:flex; flex-wrap:wrap; gap:5px; margin-top:10px}
|
||||
.btns button{
|
||||
flex:1 1 0; min-width:0; margin-top:0; padding:6px 0; font-size:11px;
|
||||
flex:0 0 calc(33.333% - 4px); min-width:0; margin-top:0;
|
||||
padding:6px 0; font-size:11px;
|
||||
background:linear-gradient(#5c4a34,#463725); border-color:#3a2c1c;
|
||||
}
|
||||
</style>
|
||||
@@ -126,6 +127,8 @@ var COLS=17, ROWS=15, CELL=32;
|
||||
var W=COLS*CELL, H=ROWS*CELL;
|
||||
var SIZE=28, OFF=(CELL-SIZE)/2;
|
||||
var EMPTY=0, BRICK=1, STEEL=2, BASE=3, RUIN=4, WATER=5, FOREST=6;
|
||||
var MIRROR_A=7, MIRROR_B=8, EBASE=9, ERUIN=10; /* 반사판 / 적 본진 */
|
||||
var CH_MA="/", CH_MB=String.fromCharCode(92);
|
||||
|
||||
var BASE_C=8, BASE_R=14;
|
||||
var PLAYER_SPAWN={c:5,r:13};
|
||||
@@ -258,6 +261,31 @@ var STAGES=[
|
||||
".BB.B..BBB..B.BB.",
|
||||
".S.....BEB.....S."
|
||||
]
|
||||
},
|
||||
{
|
||||
name:"STAGE 6 · 거울 요새",
|
||||
maxOnField:4,
|
||||
enemies:["hunter","heavy","scout","hunter","heavy","guard","hunter","heavy","scout","hunter","heavy","commander"],
|
||||
items:["freeze","shield","power"],
|
||||
itemEvery:13,
|
||||
specials:"반사판(포탄 90° 꺾임) · 적 본진 습격(부수면 즉시 승리)",
|
||||
map:[
|
||||
".................",
|
||||
".BB....SSS....BB.",
|
||||
".B...B.SXS.B...B.",
|
||||
".B.BBB.S.S.BBB.B.",
|
||||
"...B...S.S...B...",
|
||||
".BB.BB.S.S.BB.BB.",
|
||||
"...B..../..B...B.",
|
||||
"SS..B..BBB..B..SS",
|
||||
".B.\\B.......B/.B.",
|
||||
".BBB.B.B.B.B.BBB.",
|
||||
"..B./.......\\.B..",
|
||||
".B.BBB.BBB.BBB.B.",
|
||||
".B...B.BBB.B...B.",
|
||||
".BB.B..BBB..B.BB.",
|
||||
".S.....BEB.....S."
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -317,6 +345,7 @@ var sfx={
|
||||
item:function(){ tone("sine",900,1400,0.10,0.05); tone("sine",1400,1900,0.10,0.04,0.09); },
|
||||
pickup:function(){ var n=[784,1047,1319],i; for(i=0;i<3;i++) tone("square",n[i],n[i],0.11,0.09,i*0.07); },
|
||||
splash:function(){ noise(0.16,0.13,900,240,"bandpass"); },
|
||||
mirror:function(){ tone("triangle",1800,2600,0.07,0.07); tone("sine",2600,1400,0.09,0.04,0.03); },
|
||||
win:function(){ var n=[523,659,784,1047],i; for(i=0;i<4;i++) tone("square",n[i],n[i],0.16,0.11,i*0.14); },
|
||||
lose:function(){ var n=[392,330,262,196],i; for(i=0;i<4;i++) tone("sawtooth",n[i],n[i]*0.95,0.26,0.12,i*0.18); }
|
||||
};
|
||||
@@ -354,7 +383,8 @@ function buildGrid(src){
|
||||
var row=[];
|
||||
for(c=0;c<COLS;c++){
|
||||
var ch=line.charAt(c);
|
||||
row.push(ch==="B"?BRICK:ch==="S"?STEEL:ch==="E"?BASE:ch==="W"?WATER:ch==="F"?FOREST:EMPTY);
|
||||
row.push(ch==="B"?BRICK:ch==="S"?STEEL:ch==="E"?BASE:ch==="W"?WATER:ch==="F"?FOREST:
|
||||
ch===CH_MA?MIRROR_A:ch===CH_MB?MIRROR_B:ch==="X"?EBASE:EMPTY);
|
||||
}
|
||||
g.push(row);
|
||||
}
|
||||
@@ -402,7 +432,9 @@ function syncHud(){
|
||||
/* ===================== 지형 유틸 ===================== */
|
||||
function isSolid(t){ return t===BRICK||t===STEEL||t===BASE; }
|
||||
/* 물길: 탱크는 막고 포탄은 넘어간다. rectBlocked 는 탱크 이동에만 쓰인다 */
|
||||
function blocksTank(t){ return isSolid(t)||t===WATER; }
|
||||
function blocksTank(t){
|
||||
return isSolid(t)||t===WATER||t===MIRROR_A||t===MIRROR_B||t===EBASE;
|
||||
}
|
||||
function rectBlocked(x,y,w,h){
|
||||
var c1=Math.floor(x/CELL), c2=Math.floor((x+w-1)/CELL);
|
||||
var r1=Math.floor(y/CELL), r2=Math.floor((y+h-1)/CELL);
|
||||
@@ -588,7 +620,8 @@ function losOpen(x1,y1,x2,y2){
|
||||
var k=i/steps, x=x1+(x2-x1)*k, y=y1+(y2-y1)*k;
|
||||
var c=Math.floor(x/CELL), r=Math.floor(y/CELL);
|
||||
if(c<0||r<0||c>=COLS||r>=ROWS) return false;
|
||||
if(grid[r][c]===STEEL) return false;
|
||||
var t=grid[r][c];
|
||||
if(t===STEEL||t===MIRROR_A||t===MIRROR_B||t===EBASE) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -727,6 +760,30 @@ function updateBullets(dt){
|
||||
sfx.brick(); b.gone=true; break;
|
||||
}
|
||||
if(t===STEEL){ spark(cx,cy); sfx.steel(); b.gone=true; break; }
|
||||
if(t===MIRROR_A||t===MIRROR_B){
|
||||
if((b.bounces||0)>=5){ spark(cx,cy); b.gone=true; break; } /* 무한 반사 방지 */
|
||||
b.bounces=(b.bounces||0)+1;
|
||||
var nd;
|
||||
if(t===MIRROR_A) nd=[-b.dy,-b.dx]; /* "/" */
|
||||
else nd=[ b.dy, b.dx]; /* "\\" */
|
||||
b.dx=nd[0]; b.dy=nd[1];
|
||||
/* 칸 중심에 맞춘 뒤 다음 칸으로 한 칸 밀어 같은 반사판을 두 번 타지 않게 한다 */
|
||||
b.x=c*CELL+CELL/2+b.dx*(CELL/2+1)-3;
|
||||
b.y=r*CELL+CELL/2+b.dy*(CELL/2+1)-3;
|
||||
spark(cx,cy); sfx.mirror();
|
||||
continue;
|
||||
}
|
||||
if(t===EBASE){
|
||||
if(b.player){
|
||||
grid[r][c]=ERUIN;
|
||||
boom(c*CELL+CELL/2,r*CELL+CELL/2,true);
|
||||
b.gone=true;
|
||||
clearStage(1000,"적 본진 격파 +1000");
|
||||
}else{
|
||||
spark(cx,cy); sfx.steel(); b.gone=true; /* 적 포탄은 제 본진을 못 부순다 */
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(t===BASE){
|
||||
if(b.player){ /* 아군 포탄은 기지를 부수지 못한다 */
|
||||
spark(cx,cy); sfx.steel();
|
||||
@@ -780,26 +837,27 @@ function updateBullets(dt){
|
||||
bullets=keep;
|
||||
}
|
||||
|
||||
function clearStage(bonus,note){
|
||||
if(state!=="play") return;
|
||||
score+=bonus;
|
||||
if(stage<STAGES.length){
|
||||
state="clear";
|
||||
msg="STAGE "+stage+" CLEAR";
|
||||
msg2=(note?note+" · ":"")+"Space / Enter 로 "+(stage+1)+"단계 진입";
|
||||
var nx=STAGES[stage];
|
||||
msg3=nx&&nx.specials?("다음 단계 특수 요소 — "+nx.specials):null;
|
||||
}else{
|
||||
state="win";
|
||||
msg="ALL CLEAR!";
|
||||
msg2=(note?note+" · ":"")+"모든 단계 돌파 · R 키로 재도전";
|
||||
msg3=null;
|
||||
}
|
||||
sfx.win(); syncHud();
|
||||
}
|
||||
function afterKill(){
|
||||
syncHud();
|
||||
if(enemyQueue.length===0 && enemies.length===0){
|
||||
if(state==="play"){
|
||||
score+=500;
|
||||
if(stage<STAGES.length){
|
||||
state="clear";
|
||||
msg="STAGE "+stage+" CLEAR";
|
||||
msg2="Space / Enter 로 "+(stage+1)+"단계 진입";
|
||||
var nx=STAGES[stage];
|
||||
msg3=nx&&nx.specials?("다음 단계 특수 요소 — "+nx.specials):null;
|
||||
}else{
|
||||
state="win";
|
||||
msg="ALL CLEAR!"; msg2="모든 단계 돌파 · R 키로 재도전"; msg3=null;
|
||||
}
|
||||
sfx.win(); syncHud();
|
||||
}
|
||||
}else{
|
||||
fillEnemySpawns(1.2);
|
||||
}
|
||||
if(enemyQueue.length===0 && enemies.length===0) clearStage(500,null);
|
||||
else fillEnemySpawns(1.2);
|
||||
}
|
||||
function killPlayer(){
|
||||
boom(player.x+SIZE/2,player.y+SIZE/2,true);
|
||||
@@ -963,6 +1021,53 @@ function drawForest(){
|
||||
for(var r=0;r<ROWS;r++) for(var c=0;c<COLS;c++)
|
||||
if(grid[r][c]===FOREST) drawForestCell(c,r);
|
||||
}
|
||||
function drawMirrorCell(c,r,kind){
|
||||
var x=c*CELL, y=r*CELL;
|
||||
ctx.fillStyle="#2b3138";
|
||||
ctx.fillRect(x,y,CELL,CELL);
|
||||
ctx.fillStyle="#3c444d";
|
||||
ctx.fillRect(x+2,y+2,CELL-4,CELL-4);
|
||||
/* 거울면 */
|
||||
ctx.save();
|
||||
ctx.lineCap="round";
|
||||
var a=(kind===MIRROR_A)?[x+5,y+CELL-5,x+CELL-5,y+5]:[x+5,y+5,x+CELL-5,y+CELL-5];
|
||||
ctx.strokeStyle="rgba(0,0,0,.55)"; ctx.lineWidth=6;
|
||||
ctx.beginPath(); ctx.moveTo(a[0],a[1]); ctx.lineTo(a[2],a[3]); ctx.stroke();
|
||||
ctx.strokeStyle="#dff2ff"; ctx.lineWidth=3.2;
|
||||
ctx.beginPath(); ctx.moveTo(a[0],a[1]); ctx.lineTo(a[2],a[3]); ctx.stroke();
|
||||
ctx.strokeStyle="rgba(120,210,255,.85)"; ctx.lineWidth=1.2;
|
||||
ctx.beginPath(); ctx.moveTo(a[0],a[1]); ctx.lineTo(a[2],a[3]); ctx.stroke();
|
||||
ctx.restore();
|
||||
ctx.strokeStyle="rgba(10,14,18,.6)"; ctx.lineWidth=1;
|
||||
ctx.strokeRect(x+0.5,y+0.5,CELL-1,CELL-1);
|
||||
}
|
||||
function drawEnemyBase(c,r,ruin){
|
||||
var x=c*CELL, y=r*CELL;
|
||||
ctx.fillStyle="#2a1a1e";
|
||||
ctx.fillRect(x,y,CELL,CELL);
|
||||
if(ruin){
|
||||
ctx.fillStyle="#5a3a42";
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x+4,y+CELL-4); ctx.lineTo(x+CELL/2-3,y+16);
|
||||
ctx.lineTo(x+CELL/2+5,y+20); ctx.lineTo(x+CELL-4,y+CELL-4);
|
||||
ctx.closePath(); ctx.fill();
|
||||
return;
|
||||
}
|
||||
ctx.fillStyle="#e3a8bc"; /* 적 독수리 */
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x+CELL/2,y+CELL-5);
|
||||
ctx.lineTo(x+CELL-5,y+CELL-13);
|
||||
ctx.lineTo(x+CELL-9,y+CELL-13);
|
||||
ctx.lineTo(x+CELL-5,y+5);
|
||||
ctx.lineTo(x+5,y+5);
|
||||
ctx.lineTo(x+9,y+CELL-13);
|
||||
ctx.lineTo(x+5,y+CELL-13);
|
||||
ctx.closePath(); ctx.fill();
|
||||
ctx.fillStyle="#a5566e";
|
||||
ctx.fillRect(x+CELL/2-2,y+6,4,CELL-15);
|
||||
ctx.fillStyle="#7e3b50";
|
||||
ctx.fillRect(x+6,y+4,CELL-12,3);
|
||||
}
|
||||
function drawBase(c,r,ruin){
|
||||
var x=c*CELL, y=r*CELL;
|
||||
ctx.fillStyle="#2a221a";
|
||||
@@ -998,6 +1103,9 @@ function drawMap(){
|
||||
else if(t===BASE) drawBase(c,r,false);
|
||||
else if(t===RUIN) drawBase(c,r,true);
|
||||
else if(t===WATER) drawWaterCell(c,r);
|
||||
else if(t===MIRROR_A||t===MIRROR_B) drawMirrorCell(c,r,t);
|
||||
else if(t===EBASE) drawEnemyBase(c,r,false);
|
||||
else if(t===ERUIN) drawEnemyBase(c,r,true);
|
||||
}
|
||||
}
|
||||
function drawTank(t){
|
||||
|
||||
Reference in New Issue
Block a user