PageSourceSearch

https://www.funnudge.com/_next/static/chunks/1364.ce7861fb96d266c6.js

js funnudge.com collected 2026-10-02 01:30:41 UTC 15,321 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1364],{1364:(e,t,r)=>{r.r(t),r.d(t,{default:()=>f});var l=r(5155),a=r(2115),n=r(1175),i=r(4107),o=r(3557),s=r(1665),d=r(8978);let h=[{name:"Warm welcome",start:{x:70,y:350},door:{x:1120,y:285,w:48,h:70},platforms:[{x:0,y:410,w:320,h:40},{x:380,y:365,w:160,h:28,trap:"fall"},{x:610,y:330,w:180,h:28},{x:860,y:360,w:130,h:28,trap:"fall"},{x:1060,y:355,w:170,h:40}],spikes:[{x:665,y:300,w:70,h:30,triggerX:610}],crushers:[]},{name:"Do not trust floors",start:{x:60,y:320},door:{x:1325,y:265,w:48,h:70},platforms:[{x:0,y:380,w:250,h:40},{x:320,y:340,w:120,h:28,trap:"fall"},{x:500,y:300,w:120,h:28},{x:690,y:330,w:180,h:28,trap:"fall"},{x:960,y:300,w:170,h:28},{x:1230,y:335,w:220,h:40}],spikes:[{x:508,y:270,w:80,h:30,triggerX:470},{x:1030,y:270,w:70,h:30,triggerX:950}],crushers:[{x:775,y:120,w:76,h:76,triggerX:690}]},{name:"Wrong door",start:{x:60,y:330},door:{x:1455,y:236,w:48,h:70},fakeExit:{x:710,y:254,w:48,h:70},platforms:[{x:0,y:390,w:240,h:40},{x:290,y:350,w:150,h:28},{x:500,y:325,w:160,h:28,trap:"fall"},{x:690,y:324,w:130,h:28},{x:920,y:345,w:120,h:28,trap:"fall"},{x:1110,y:305,w:140,h:28},{x:1380,y:306,w:190,h:40}],spikes:[{x:330,y:320,w:70,h:30,triggerX:260},{x:1185,y:275,w:62,h:30,triggerX:1080}],crushers:[{x:980,y:92,w:86,h:86,triggerX:905}]},{name:"Last laugh",start:{x:60,y:350},door:{x:1605,y:245,w:50,h:70},platforms:[{x:0,y:410,w:250,h:40},{x:315,y:365,w:115,h:28},{x:500,y:320,w:120,h:28,trap:"fall"},{x:720,y:285,w:130,h:28},{x:940,y:330,w:150,h:28,trap:"fall"},{x:1180,y:290,w:130,h:28},{x:1400,y:315,w:130,h:28,trap:"fall"},{x:1540,y:315,w:190,h:40}],spikes:[{x:725,y:255,w:86,h:30,triggerX:680},{x:1210,y:260,w:78,h:30,triggerX:1135},{x:1580,y:285,w:72,h:30,triggerX:1490}],crushers:[{x:530,y:80,w:82,h:82,triggerX:470},{x:1010,y:100,w:78,h:78,triggerX:925}]}];function c(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}function x(e){let t=h[e];return{...t,platforms:t.platforms.map(e=>({...e})),spikes:t.spikes.map(e=>({...e})),crushers:t.crushers.map(e=>({...e})),fallTimers:t.platforms.map(()=>0),spikeShown:t.spikes.map(()=>!1),crusherY:t.crushers.map(e=>e.y),crusherFalling:t.crushers.map(()=>!1)}}function f(){let e=(0,a.useRef)(null),[t,r]=(0,a.useState)("idle"),[f,u]=(0,a.useState)(0),[m,p]=(0,a.useState)(0),{best:y,submit:w}=(0,o.g)("trapdoor-platformer"),g=(0,a.useRef)("idle"),b=(0,a.useRef)(0),v=(0,a.useRef)(()=>{}),k=(0,a.useRef)({left:!1,right:!1,jump:!1});g.current=t,(0,a.useEffect)(()=>{let t=e.current;if(!t)return;let l=t.getContext("2d");if(!l)return;let a=900,o=600,s=1,d=()=>{let e=t.getBoundingClientRect();a=e.width||900,o=e.height||600,s=Math.min(window.devicePixelRatio||1,2),t.width=Math.floor(a*s),t.height=Math.floor(o*s),l.setTransform(s,0,0,s,0,0)};d();let f=new ResizeObserver(d);f.observe(t);let m=x(0),y={x:m.start.x,y:m.start.y,vx:0,vy:0,grounded:!1,jumpLatch:!1,deadTilt:0},j=0,S=0,N=0,T=!1,P=e=>{y.x=(m=x(j=e)).start.x,y.y=m.start.y,y.vx=0,y.vy=0,y.grounded=!1,y.jumpLatch=!1,y.deadTilt=0,S=0,p(j)},R=()=>{N=0,T=!1,b.current=0,u(0),P(0),r("running")};v.current=R;let M=e=>{if(T)return;T=!0;let t=e?Math.max(b.current,1500+Math.floor(Math.max(0,300-7*N))):b.current;b.current=t,u(t),w(t),(0,i.q7)("trapdoor-platformer",t),(0,n._O)(e?"win":"lose"),r(e?"won":"over")},C=()=>{y.deadTilt=1,M(!1)},L=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.fillStyle=t?"#92400e":"#14532d",l.fillRect(e.x,e.y,e.w,e.h),l.fillStyle=t?"#fed7aa":"#bbf7d0",l.fillRect(e.x+8,e.y+8,e.w-16,e.h-16),l.fillStyle="#111827",l.beginPath(),l.arc(e.x+e.w-14,e.y+e.h/2,4,0,2*Math.PI),l.fill()},z=(e,t)=>{if(!t){l.fillStyle="#57534e",l.fillRect(e.x,e.y+e.h-5,e.w,5);return}l.fillStyle="#e11d48";let r=Math.max(3,Math.floor(e.w/16));for(let t=0;t<r;t++){let a=e.x+t*e.w/r;l.beginPath(),l.moveTo(a,e.y+e.h),l.lineTo(a+e.w/r/2,e.y),l.lineTo(a+e.w/r,e.y+e.h),l.closePath(),l.fill()}},E=0,X=performance.now(),A=e=>{let t=Math.min((e-X)/1e3,.033);if(X=e,"running"===g.current){N+=t;let e=k.current,r=!!e.right-!!e.left;y.vx+=(260*r-y.vx)*Math.min(14*t,1),y.vy+=1350*t,e.jump&&y.grounded&&!y.jumpLatch&&(y.vy=-560,y.grounded=!1,y.jumpLatch=!0,(0,n._O)("jump")),e.jump||(y.jumpLatch=!1),y.x+=y.vx*t;let l={x:y.x,y:y.y,w:26,h:42};for(let e of m.platforms)("fall"!==e.trap||!(m.fallTimers[m.platforms.indexOf(e)]>.34))&&c(l,e)&&(y.vx>0&&(y.x=e.x-26),y.vx<0&&(y.x=e.x+e.w),y.vx=0);y.y+=y.vy*t,y.grounded=!1;let a={x:y.x,y:y.y,w:26,h:42};for(let e=0;e<m.platforms.length;e++){let t=m.platforms[e];("fall"!==t.trap||!(m.fallTimers[e]>.34))&&c(a,t)&&(y.vy>0?(y.y=t.y-42,y.vy=0,y.grounded=!0,"fall"===t.trap&&0===m.fallTimers[e]&&(m.fallTimers[e]=.001,(0,n._O)("tap"))):y.vy<0&&(y.y=t.y+t.h,y.vy=0))}for(let e=0;e<m.fallTimers.length;e++)m.fallTimers[e]>0&&(m.fallTimers[e]+=t);for(let e=0;e<m.spikes.length;e++)!m.spikeShown[e]&&y.x>m.spikes[e].triggerX&&(m.spikeShown[e]=!0,(0,n._O)("tap")),m.spikeShown[e]&&c({x:y.x,y:y.y,w:26,h:42},m.spikes[e])&&C();for(let e=0;e<m.crushers.length;e++){let r=m.crushers[e];!m.crusherFalling[e]&&y.x>r.triggerX&&(m.crusherFalling[e]=!0,(0,n._O)("tap")),m.crusherFalling[e]&&(m.crusherY[e]=Math.min(r.y+235,m.crusherY[e]+520*t)),c({x:y.x,y:y.y,w:26,h:42},{...r,y:m.crusherY[e]})&&C()}m.fakeExit&&c({x:y.x,y:y.y,w:26,h:42}
1,m.fakeExit)&&(m.spikeShown=m.spikeShown.map(()=>!0),(0,n._O)("tap")),c({x:y.x,y:y.y,w:26,h:42},m.door)&&(()=>{if((0,n._O)("win"),j>=h.length-1)return M(!0);b.current+=250,u(b.current),w(b.current),P(j+1)})(),y.y>760&&C();let i=350*j+Math.max(0,Math.floor(y.x/4));i>b.current&&!T&&(b.current=i,u(i),w(i))}S+=(y.x-.35*a-S)*Math.min(6*t,1),S=Math.max(0,S),l.setTransform(s,0,0,s,0,0),(()=>{let e=l.createLinearGradient(0,0,0,o);e.addColorStop(0,"#172033"),e.addColorStop(.58,"#223249"),e.addColorStop(1,"#dbeafe"),l.fillStyle=e,l.fillRect(0,0,a,o),l.save(),l.translate(-(.35*S),0);for(let e=-1;e<10;e++){let t=360*e;l.fillStyle=e%2?"rgba(15,23,42,.32)":"rgba(51,65,85,.34)",l.fillRect(t,80,140,o-150),l.fillRect(t+170,130,110,o-195),l.fillStyle="rgba(148,163,184,.18)";for(let e=110;e<o-105;e+=46)l.fillRect(t+22,e,42,3),l.fillRect(t+86,e+18,28,3)}l.strokeStyle="rgba(125,211,252,.12)",l.lineWidth=1;for(let e=-120;e<S+a+240;e+=72)l.beginPath(),l.moveTo(e,0),l.lineTo(e,o),l.stroke();l.restore(),l.save(),l.translate(-S,o-500),l.fillStyle="rgba(226,232,240,.92)",l.font="bold 16px system-ui",l.fillText(m.name,S+24,44),l.fillStyle="rgba(239,68,68,.8)";for(let e=S+24;e<S+a;e+=115)l.fillRect(e,64,44,5);for(let e=0;e<m.platforms.length;e++){let t=m.platforms[e],r=m.fallTimers[e]>0?Math.min(80,150*m.fallTimers[e]):0,a=l.createLinearGradient(t.x,t.y+r,t.x,t.y+r+t.h);"fall"===t.trap?(a.addColorStop(0,"#a78bfa"),a.addColorStop(1,"#6d28d9")):(a.addColorStop(0,"#64748b"),a.addColorStop(1,"#263548")),l.fillStyle="rgba(15,23,42,.18)",l.fillRect(t.x+6,t.y+r+7,t.w,t.h),l.fillStyle=a,l.beginPath(),l.roundRect(t.x,t.y+r,t.w,t.h,5),l.fill(),l.fillStyle="rgba(255,255,255,.15)",l.fillRect(t.x+4,t.y+r+4,t.w-8,5),l.strokeStyle="rgba(15,23,42,.35)",l.lineWidth=2;for(let e=t.x+20;e<t.x+t.w;e+=28)l.beginPath(),l.moveTo(e,t.y+r+4),l.lineTo(e-16,t.y+r+t.h-4),l.stroke()}for(let e=0;e<m.spikes.length;e++)z(m.spikes[e],m.spikeShown[e]);for(let e=0;e<m.crushers.length;e++){let t=m.crushers[e],r=m.crusherY[e];l.fillStyle="#20242b",l.fillRect(t.x,r,t.w,t.h),l.fillStyle="#ef4444",l.fillRect(t.x+8,r+t.h-10,t.w-16,8)}m.fakeExit&&L(m.fakeExit,!0),L(m.door),l.save(),l.translate(y.x+13,y.y+21),l.rotate(.75*!!y.deadTilt),l.fillStyle="rgba(0,0,0,.2)",l.beginPath(),l.ellipse(0,30,21,5,0,0,2*Math.PI),l.fill();let t=y.grounded?Math.sin(performance.now()/90)*Math.min(1,Math.abs(y.vx)/260):.65;l.strokeStyle="#1f2937",l.lineWidth=6,l.lineCap="round",l.beginPath(),l.moveTo(-4,6),l.lineTo(-13,24+7*t),l.moveTo(5,6),l.lineTo(13,24-7*t),l.stroke(),l.strokeStyle="#0f172a",l.lineWidth=5,l.beginPath(),l.moveTo(-12,-4),l.lineTo(-21,10-6*t),l.moveTo(12,-4),l.lineTo(21,9+6*t),l.stroke();let r=l.createLinearGradient(-13,-12,13,18);r.addColorStop(0,"#fbbf24"),r.addColorStop(.55,"#f59e0b"),r.addColorStop(1,"#b45309"),l.fillStyle=r,l.beginPath(),l.roundRect(-15,-12,30,36,7),l.fill(),l.fillStyle="#0f172a",l.fillRect(-11,-2,22,5),l.fillStyle="#f2c7a5",l.beginPath(),l.arc(0,-12,13,0,2*Math.PI),l.fill(),l.fillStyle="#334155",l.beginPath(),l.arc(0,-17,14,Math.PI,2*Math.PI),l.fill(),l.fillStyle="#111827",l.fillRect(-7,-15,4,4),l.fillRect(5,-15,4,4),l.fillStyle="#38bdf8",l.fillRect(-13,13,26,7),l.restore(),l.restore()})(),E=requestAnimationFrame(A)};E=requestAnimationFrame(A);let _=(e,t)=>{("ArrowLeft"===e.key||"a"===e.key||"A"===e.key)&&(k.current.left=t,e.preventDefault()),("ArrowRight"===e.key||"d"===e.key||"D"===e.key)&&(k.current.right=t,e.preventDefault()),("Space"===e.code||"ArrowUp"===e.key||"w"===e.key||"W"===e.key)&&(k.current.jump=t,e.preventDefault()),t&&"Enter"===e.key&&"running"!==g.current&&R()},W=e=>_(e,!0),D=e=>_(e,!1);return window.addEventListener("keydown",W),window.addEventListener("keyup",D),()=>{cancelAnimationFrame(E),f.disconnect(),window.removeEventListener("keydown",W),window.removeEventListener("keyup",D)}},[]);let j=(e,t)=>{k.current[e]=t};return(0,l.jsxs)("div",{className:"select-none",children:[(0,l.jsx)(s.A,{title:"Trapdoor Platformer",eyebrow:"Troll lab",scoreLabel:"Score",score:f,best:y,levelLabel:"Level",level:m+1,status:"running"===t?"Trap armed":"Ready",cta:"running"===t?"Restart":"Start",accent:"from-violet-500 to-rose-500",onStart:()=>v.current()}),(0,l.jsxs)("div",{"data-board":!0,className:"relative mx-auto aspect-square w-full touch-none overflow-hidden rounded-[1.35rem] border border-fuchsia-200/30 bg-sky-100 shadow-2xl shadow-fuchsia-950/25 sm:aspect-[4/3]",style:{maxWidth:"min(100%, calc(82vh * 1.333))"},role:"application","aria-label":"Trapdoor Platformer game. Use arrows or WASD to run and jump.",children:[(0,l.jsx)("canvas",{ref:e,className:"h-full w-full"}),(0,l.jsx)(d.A,{}),"running"!==t&&(0,l.jsxs)("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-slate-950/55 text-center backdrop-blur-[2px]",children:[(0,l.jsx)("p",{className:"text-4xl font-extrabold text-white",children:"won"===t?"You escaped":"over"===t?"The level lied":"Trapdoor Platformer"}),(0,l.jsx)("p",{className:"max-w-md px-4 text-sm text-zinc-200",children:"Platforms drop, spikes wake up late, and the obvious path is usually trouble."}),(0,l.jsx)("button",{onClick:e=>{e.stopPropagation(),v.current()},className:"rounded-xl bg-gradient-to-r from-violet-500 to-rose-500 px-6 py-3 font-bold text-white transition hover:scale-105",children:"idle"===t?"Start level":"Try again"})]}),(0,l.jsxs)("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 z-20 flex items-end justify-between px-3 sm:hidden",children:[(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{className:"pointer-events-auto h-14 w-16 rounded-xl bg-black/45 font-bold text-white",onPointerDown:()=>j("left",!0),onPointerUp:()=>j("left",!1),onPointerCancel:()=>j("left",!1),children:"Left"}),(0,l.jsx)("button",{className:"pointer-events-auto h-14 w-16 rounded-xl bg-black/45 font-bold text-white",onPointerDown:()=>j("right",!0),onPointerUp:()=>j("right",!1),onPointerCancel:()=>j("right",!1),children:"Right"})]}),(0,l.jsx)("button",{className:"pointer-events-auto h-14 min-w-24 rounded-xl bg-white/20 px-4 font-bold text-white",onPointerDown:()=>j("jump",!0),onPointerUp:()=>j("jump",!1),onPointerCancel:()=>j("jump",!1),children:"Jump"})]})]}),(0,l.jsx)("p",{className:"mt-4 text-center text-sm text-zinc-500",children:"A/D or arrows to run, Space/W/Up to jump. Watch for platforms that move after you trust them."})]})}},1665:(e,t,r)=>{r.d(t,{A:()=>a});var l=r(5155);function a(e){let{title:t,eyebrow:r,scoreLabel:a,score:n,best:i,levelLabel:o,level:s,status:d,cta:h,onStart:c,accent:x}=e;return(0,l.jsxs)("div",{className:"relative mb-4 overflow-hidden rounded-2xl border border-white/10 bg-zinc-950/70 p-3 shadow-2xl shadow-black/25 backdrop-blur-xl",children:[(0,l.jsx)("div",{className:"pointer-events-none absolute inset-x-8 h-px bg-gradient-to-r ".concat(x," opacity-70"),"aria-hidden":!0}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,l.jsx)("span",{className:"h-2 w-2 rounded-full bg-gradient-to-r ".concat(x," shadow-lg"),"aria-hidden":!0}),(0,l.jsx)("span",{className:"text-[11px] font-black uppercase tracking-[0.18em] text-zinc-400",children:r})]}),(0,l.jsx)("h3",{className:"truncate text-lg font-black text-white sm:text-2xl",children:t})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)("div",{className:"rounded-xl border border-white/10 bg-white/[0.07] px-3 py-2 text-center shadow-inner shadow-white/5",children:[(0,l.jsx)("div",{className:"text-[10px] font-black uppercase tracking-[0.16em] text-zinc-500",children:a}),(0,l.jsx)("div",{className:"text-xl font-black tabular-nums text-white",children:n})]}),o&&void 0!==s&&(0,l.jsxs)("div",{className:"rounded-xl border border-white/10 bg-white/[0.07] px-3 py-2 text-center shadow-inner shadow-white/5",children:[(0,l.jsx)("div",{className:"text-[10px] font-black uppercase tracking-[0.16em] text-zinc-500",children:o}),(0,l.jsx)("div",{className:"text-xl font-black tabular-nums text-cyan-200",children:s})]}),void 0!==i&&(0,l.jsxs)("div",{className:"hidden rounded-xl border border-amber-300/20 bg-amber-300/10 px-3 py-2 text-center shadow-inner shadow-amber-100/5 sm:block",children:[(0,l.jsx)("div",{className:"text-[10px] font-black uppercase tracking-[0.16em] text-amber-200/70",children:"Best"}),(0,l.jsx)("div",{className:"text-xl font-black tabular-nums text-amber-200",children:i})]}),(0,l.jsx)("div",{className:"hidden rounded-xl border border-white/10 bg-white/[0.05] px-3 py-2 text-sm font-bold text-zinc-300 sm:block",children:d}),(0,l.jsx)("button",{onClick:c,className:"rounded-xl bg-gradient-to-r ".concat(x," px-4 py-3 text-sm font-black text-white shadow-lg transition hover:-translate-y-0.5 hover:shadow-xl active:translate-y-0"),children:h})]})]})]})}},3557:(e,t,r)=>{r.d(t,{g:()=>a});
1var l=r(2115);function a(e){let[t,r]=(0,l.useState)(0);return(0,l.useEffect)(()=>{try{let t=window.localStorage.getItem("funnudge:".concat(e));t&&r(Number(t)||0)}catch(e){}},[e]),{best:t,submit:(0,l.useCallback)(t=>{r(r=>{if(t<=r)return r;try{window.localStorage.setItem("funnudge:".concat(e),String(t))}catch(e){}return t})},[e])}}},8978:(e,t,r)=>{r.d(t,{A:()=>a});var l=r(5155);function a(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[5] rounded-[1.35rem] ring-1 ring-inset ring-white/20","aria-hidden":!0}),(0,l.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[5] rounded-[1.35rem] bg-[linear-gradient(180deg,rgba(255,255,255,.18),transparent_18%,transparent_72%,rgba(0,0,0,.22))]","aria-hidden":!0}),(0,l.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-[5] h-14 bg-gradient-to-b from-white/15 to-transparent","aria-hidden":!0}),(0,l.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] h-20 bg-gradient-to-t from-black/20 to-transparent","aria-hidden":!0})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.