smoothretro1982

Fireworks (vaporizer) Hud 4.0

Mar 15th, 2026 (edited)
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.91 KB | None | 0 0
  1. (async () => {
  2.  
  3. const sleep = ms => new Promise(r=>setTimeout(r,ms));
  4. const rand=(a,b)=>Math.floor(Math.random()*(b-a+1))+a;
  5.  
  6. const chars="█▓▒░@#*+=:.~".split("");
  7.  
  8. let mouseX=0;
  9. let mouseY=0;
  10.  
  11. document.addEventListener("mousemove",e=>{
  12. mouseX=e.clientX;
  13. mouseY=e.clientY;
  14. });
  15.  
  16. function randChar(){
  17. return chars[rand(0,chars.length-1)];
  18. }
  19.  
  20. function writeCharAt(c,col,x,y){
  21. w.changeColor(col);
  22. w.tp(Math.round(x),Math.round(y));
  23. writeChar(c,1);
  24. }
  25.  
  26. function createParticles(x,y,count,speed,life){
  27.  
  28. const parts=[];
  29.  
  30. for(let i=0;i<count;i++){
  31.  
  32. const a=Math.random()*Math.PI*2;
  33.  
  34. parts.push({
  35. x,
  36. y,
  37. vx:Math.cos(a)*Math.random()*speed,
  38. vy:Math.sin(a)*Math.random()*speed,
  39. life,
  40. char:randChar(),
  41. color:rand(2,29)
  42. });
  43.  
  44. }
  45.  
  46. return parts;
  47. }
  48.  
  49. async function runParticles(parts,gravity,delay){
  50.  
  51. while(parts.length){
  52.  
  53. for(let i=parts.length-1;i>=0;i--){
  54.  
  55. let p=parts[i];
  56.  
  57. p.x+=p.vx;
  58. p.y+=p.vy;
  59.  
  60. p.vy+=gravity;
  61.  
  62. writeCharAt(p.char,p.color,p.x,p.y);
  63.  
  64. p.life--;
  65.  
  66. if(p.life<=0) parts.splice(i,1);
  67.  
  68. }
  69.  
  70. await sleep(delay);
  71.  
  72. }
  73.  
  74. }
  75.  
  76. async function lava(cx,cy,r){
  77.  
  78. for(let i=0;i<r*40;i++){
  79.  
  80. let dx=rand(-r,r);
  81. let dy=rand(-r,r);
  82.  
  83. if(dx*dx+dy*dy<=r*r){
  84.  
  85. writeCharAt("~",rand(9,14),cx+dx,cy+dy);
  86.  
  87. }
  88.  
  89. await sleep(5);
  90.  
  91. }
  92.  
  93. }
  94.  
  95. async function lightning(cx,cy){
  96.  
  97. let x=cx;
  98. let y=cy;
  99.  
  100. for(let i=0;i<150;i++){
  101.  
  102. x+=rand(-2,2);
  103. y+=rand(-1,1);
  104.  
  105. writeCharAt("⚡",11,x,y);
  106.  
  107. await sleep(20);
  108.  
  109. }
  110.  
  111. }
  112.  
  113. async function gravityCollapse(cx,cy,r){
  114.  
  115. for(let d=r;d>0;d--){
  116.  
  117. for(let dx=-d;dx<=d;dx++)
  118. for(let dy=-d;dy<=d;dy++){
  119.  
  120. if(dx*dx+dy*dy<=d*d){
  121.  
  122. writeCharAt(".",0,cx+dx,cy+dy);
  123.  
  124. }
  125.  
  126. }
  127.  
  128. await sleep(30);
  129.  
  130. }
  131.  
  132. }
  133.  
  134. async function fractal(cx,cy,r,depth,particles,power,gravity,delay,duration){
  135.  
  136. if(depth<=0) return;
  137.  
  138. const p=createParticles(cx,cy,particles/4,power,duration);
  139. await runParticles(p,gravity,delay);
  140.  
  141. await fractal(cx+r/2,cy,r/2,depth-1,particles,power,gravity,delay,duration);
  142. await fractal(cx-r/2,cy,r/2,depth-1,particles,power,gravity,delay,duration);
  143. await fractal(cx,cy+r/2,r/2,depth-1,particles,power,gravity,delay,duration);
  144.  
  145. }
  146.  
  147. async function meteor(cx,cy,r,particles,power,gravity,delay,duration){
  148.  
  149. let mx=cx+rand(-r*2,r*2);
  150. let my=cy-r*5;
  151.  
  152. for(let i=0;i<r*6;i++){
  153.  
  154. mx+=(cx-mx)*0.05;
  155. my+=1.5;
  156.  
  157. writeCharAt("☄",rand(9,15),mx,my);
  158.  
  159. await sleep(delay);
  160.  
  161. }
  162.  
  163. const p=createParticles(cx,cy,particles,power*3,duration);
  164. await runParticles(p,gravity,delay);
  165.  
  166. }
  167.  
  168. async function vortex(cx,cy,particles,gravity,delay,duration){
  169.  
  170. const parts=createParticles(cx,cy,particles,2,duration);
  171.  
  172. while(parts.length){
  173.  
  174. for(let i=parts.length-1;i>=0;i--){
  175.  
  176. let p=parts[i];
  177.  
  178. let dx=cx-p.x;
  179. let dy=cy-p.y;
  180.  
  181. p.vx+=dx*0.002;
  182. p.vy+=dy*0.002;
  183.  
  184. p.x+=p.vx;
  185. p.y+=p.vy;
  186.  
  187. writeCharAt("•",rand(2,29),p.x,p.y);
  188.  
  189. p.life--;
  190.  
  191. if(p.life<=0) parts.splice(i,1);
  192.  
  193. }
  194.  
  195. await sleep(delay);
  196.  
  197. }
  198.  
  199. }
  200.  
  201. async function chain(cx,cy,r,particles,power,gravity,delay,duration){
  202.  
  203. for(let i=0;i<8;i++){
  204.  
  205. let nx=cx+rand(-r*2,r*2);
  206. let ny=cy+rand(-r*2,r*2);
  207.  
  208. const p=createParticles(nx,ny,particles/2,power*2,duration);
  209.  
  210. runParticles(p,gravity,delay);
  211.  
  212. await sleep(300);
  213.  
  214. }
  215.  
  216. }
  217.  
  218. async function shockwave(cx,cy,particles,gravity,delay,duration){
  219.  
  220. const parts=createParticles(cx,cy,particles,1,duration);
  221.  
  222. let wave=0;
  223.  
  224. while(parts.length){
  225.  
  226. wave+=0.5;
  227.  
  228. for(let i=parts.length-1;i>=0;i--){
  229.  
  230. let p=parts[i];
  231.  
  232. let dx=p.x-cx;
  233. let dy=p.y-cy;
  234. let dist=Math.sqrt(dx*dx+dy*dy);
  235.  
  236. if(dist<wave){
  237.  
  238. p.vx+=dx*0.2;
  239. p.vy+=dy*0.2;
  240.  
  241. }
  242.  
  243. p.x+=p.vx;
  244. p.y+=p.vy;
  245.  
  246. writeCharAt(randChar(),rand(2,29),p.x,p.y);
  247.  
  248. p.life--;
  249.  
  250. if(p.life<=0) parts.splice(i,1);
  251.  
  252. }
  253.  
  254. await sleep(delay);
  255.  
  256. }
  257.  
  258. }
  259.  
  260. const settings = await new Promise(resolve=>{
  261.  
  262. const hud=document.createElement("div");
  263.  
  264. Object.assign(hud.style,{
  265. position:"fixed",
  266. top:"50%",
  267. left:"50%",
  268. transform:"translate(-50%,-50%)",
  269. background:"#120000",
  270. color:"#ff9933",
  271. padding:"25px",
  272. border:"2px solid #ff3333",
  273. fontFamily:"monospace",
  274. zIndex:999999
  275. });
  276.  
  277. hud.innerHTML=`
  278.  
  279. <h2>VAPORIZER v4</h2>
  280.  
  281. Radius
  282. <input id="r" type="number" value="20" style="width:100%">
  283.  
  284. X
  285. <input id="x" type="number" style="width:100%">
  286.  
  287. Y
  288. <input id="y" type="number" style="width:100%">
  289.  
  290. Mode
  291. <select id="mode" style="width:100%">
  292. <option value="particle">Particle Explosion</option>
  293. <option value="lava">Lava Flood</option>
  294. <option value="lightning">Lightning</option>
  295. <option value="gravity">Gravity Collapse</option>
  296. <option value="fractal">Fractal Explosion</option>
  297. <option value="meteor">Meteor Strike</option>
  298. <option value="vortex">Black Hole</option>
  299. <option value="chain">Chain Reaction</option>
  300. <option value="shockwave">Shockwave</option>
  301. </select>
  302.  
  303. Speed
  304. <input id="speed" type="range" min="1" max="100" value="50" style="width:100%">
  305.  
  306. Duration
  307. <input id="duration" type="range" min="10" max="200" value="80" style="width:100%">
  308.  
  309. Particles
  310. <input id="particles" type="range" min="50" max="2000" value="500" style="width:100%">
  311.  
  312. Power
  313. <input id="power" type="range" min="1" max="10" value="3" style="width:100%">
  314.  
  315. Gravity
  316. <input id="gravity" type="range" min="0" max="10" value="3" style="width:100%">
  317.  
  318. Auto Target Cursor
  319. <input id="cursorTarget" type="checkbox">
  320.  
  321. <br><br>
  322.  
  323. <button id="go" style="width:100%;padding:10px;background:#8b0000;color:white;font-weight:bold">
  324. ARM & DETONATE
  325. </button>
  326.  
  327. `;
  328.  
  329. document.body.appendChild(hud);
  330.  
  331. document.getElementById("go").onclick=()=>{
  332.  
  333. resolve({
  334.  
  335. radius:+document.getElementById("r").value,
  336. x:+document.getElementById("x").value,
  337. y:-+document.getElementById("y").value,
  338. mode:document.getElementById("mode").value,
  339. speed:+document.getElementById("speed").value,
  340. duration:+document.getElementById("duration").value,
  341. particles:+document.getElementById("particles").value,
  342. power:+document.getElementById("power").value,
  343. gravity:+document.getElementById("gravity").value,
  344. cursorTarget:document.getElementById("cursorTarget").checked
  345.  
  346. });
  347.  
  348. hud.remove();
  349.  
  350. };
  351.  
  352. });
  353.  
  354. let {radius,x,y,mode,speed,duration,particles,power,gravity,cursorTarget}=settings;
  355.  
  356. const delay=Math.max(1,60-speed);
  357. gravity=gravity*0.02;
  358.  
  359. if(cursorTarget){
  360. x=Math.floor(mouseX/10);
  361. y=-Math.floor(mouseY/18);
  362. }
  363.  
  364. for(let i=5;i>=1;i--){
  365. console.log("Detonation in",i);
  366. await sleep(1000);
  367. }
  368.  
  369. if(mode==="particle"){
  370. const p=createParticles(x,y,particles,power,duration);
  371. await runParticles(p,gravity,delay);
  372. }
  373.  
  374. if(mode==="lava") await lava(x,y,radius);
  375. if(mode==="lightning") await lightning(x,y);
  376. if(mode==="gravity") await gravityCollapse(x,y,radius);
  377. if(mode==="fractal") await fractal(x,y,radius,3,particles,power,gravity,delay,duration);
  378. if(mode==="meteor") await meteor(x,y,radius,particles,power,gravity,delay,duration);
  379. if(mode==="vortex") await vortex(x,y,particles,gravity,delay,duration);
  380. if(mode==="chain") await chain(x,y,radius,particles,power,gravity,delay,duration);
  381. if(mode==="shockwave") await shockwave(x,y,particles,gravity,delay,duration);
  382.  
  383. })();
Advertisement
Add Comment
Please, Sign In to add comment