Cube Dash
V1 the picture attached to this is the app icon download it and use it as the app icon
vie_gamdevОтсканируй на iPhone, чтобы установить
Просмотр
V1 the picture attached to this is the app icon download it and use it as the app icon
Что нового
Версия 1.0
First release
Что делает
Действий: 8-
CommentBuilt with ShortcutStudio. Download: https://apps.apple.com/us/app/shortcutstudio-ai-shortcuts/id6760745118 Website: https://shortcutstudio.app © ShortcutStudio. All rights reserved.
-
CommentThis shortcut is public. View it at https://shortcutstudio.app/marketplace-item.html?id=AFD5E4F2-7249-407B-BA6F-FD254B7C74C1
-
CommentBuild an HTML/JS autoscroller game: square player jumps over triangle obstacles
-
Text
-
Base64 Encode
-
Get Name
-
Text
-
Open URLs
Посмотреть как код
Все действия этой команды, записанные на Cherri — языке программирования для приложения «Быстрые команды». Отлично подходит, чтобы разобраться, как она работает.
#include 'actions/web'
#include 'actions/crypto'
#define glyph clock
/*
Built with ShortcutStudio.
Download: https://apps.apple.com/us/app/shortcutstudio-ai-shortcuts/id6760745118
Website: https://shortcutstudio.app
© ShortcutStudio. All rights reserved.
*/
// This shortcut is public. View it at https://shortcutstudio.app/marketplace-item.html?id=AFD5E4F2-7249-407B-BA6F-FD254B7C74C1
// Build an HTML/JS autoscroller game: square player jumps over triangle obstacles
const GameHTML = "<html><head><style>body{margin:0;overflow:hidden;background:#222;display:flex;justify-content:center;align-items:center;height:100vh}canvas{display:block;background:#1a1a2e}</style></head><body><canvas id='game' width='400' height='600'></canvas><script>const canvas=document.getElementById('game');const ctx=canvas.getContext('2d');const player={x:80,y:500,width:28,height:28,vy:0,gravity:0.5,onGround:true};const obstacles=[];let speed=3;let score=0;let gameOver=false;let frame=0;const groundY=550;function jump(){if(player.onGround&&!gameOver){player.vy=-10;player.onGround=false;}}function spawnObstacle(){const h=Math.random()*30+20;obstacles.push({x:canvas.width,width:20,height:h,y:groundY-h});}function update(){if(gameOver)return;frame++;if(frame%30===0)spawnObstacle();player.vy+=player.gravity;player.y+=player.vy;if(player.y+player.height>=groundY){player.y=groundY-player.height;player.vy=0;player.onGround=true;}else{player.onGround=false;}for(let i=obstacles.length-1;i>=0;i--){const o=obstacles[i];o.x-=speed;if(o.x+o.width<0){obstacles.splice(i,1);score++;}if(player.x+player.width>o.x&&player.x<o.x+o.width&&player.y+player.height>o.y&&player.y<o.y+o.height){gameOver=true;}}}function draw(){ctx.clearRect(0,0,canvas.width,canvas.height);ctx.fillStyle='#0f0';ctx.fillRect(player.x,player.y,player.width,player.height);ctx.fillStyle='#f44336';for(const o of obstacles){ctx.beginPath();ctx.moveTo(o.x,o.y+o.height);ctx.lineTo(o.x+o.width/2,o.y);ctx.lineTo(o.x+o.width,o.y+o.height);ctx.closePath();ctx.fill();}ctx.fillStyle='white';ctx.font='18px monospace';ctx.fillText('Score: '+score,10,30);if(gameOver){ctx.fillStyle='white';ctx.font='32px monospace';ctx.fillText('GAME OVER',80,300);ctx.fillText('Tap to restart',90,350);}}canvas.addEventListener('click',()=>{if(gameOver){gameOver=false;obstacles.length=0;player.y=500;player.vy=0;player.onGround=true;score=0;speed=3;frame=0;}else{jump();}});canvas.addEventListener('touchstart',(e)=>{e.preventDefault();if(gameOver){gameOver=false;obstacles.length=0;player.y=500;player.vy=0;player.onGround=true;score=0;speed=3;frame=0;}else{jump();}});function gameLoop(){update();draw();requestAnimationFrame(gameLoop);}gameLoop();</script></body></html>"
const Base64Game = base64Encode(GameHTML)
const DataURL = getName(Base64Game)
const DataURLText = "data:text/html;base64,{Base64Game}"
openURL(DataURLText)
Открыть в Cherri Playground
Декомпилировано с помощью cherri 2.3.0 (GPL-2.0). Перед компиляцией могут понадобиться небольшие исправления.
Оценки и отзывы
Написать отзыв–
из 5
★★★★★
★★★★
★★★
★★
★
0 ratings
Пока нет отзывов. Поделись мнением первым!
Реклама
Ещё от vie_gamdev
Вам также может понравиться
Реклама