当前位置: 首页 > news >正文

什么网站做h5电话销售外呼系统软件

什么网站做h5,电话销售外呼系统软件,公司做网站公司,网站制作建设案例贪吃蛇游戏&#x1f579;四个按钮控制方向&#x1f3ae; 源代码在图片后面 点赞❤️关注&#x1f64f;收藏⭐️ 互粉必回&#x1f64f;&#x1f64f;&#x1f60d;&#x1f60d;&#x1f60d; 源代码&#x1f4df; <!DOCTYPE html> <html lang"en"&…

贪吃蛇游戏🕹四个按钮控制方向🎮

源代码在图片后面     点赞❤️关注🙏收藏⭐️

互粉必回🙏🙏😍😍😍

c4f905286c4d4f818c5c0277a93028b0.jpg

 源代码📟

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>贪吃蛇游戏</title>

<style>

    body {

        display: flex;

        justify-content: center;

        align-items: center;

        height: 100vh;

        background-color: #f5f5f5;

        margin: 0;

        font-family: Arial, sans-serif;

    }

    .game-container {

        width: 300px;

        text-align: center;

    }

    table {

        border-collapse: collapse;

        margin-top: 20px;

        border: 1px solid gray;

    }

    td {

        width: 10px;

        height: 10px;

        border: 1px solid gray;

    }

    .snake {

        background-color: green;

    }

    .food {

        background-color: red;

    }

    .control-buttons {

        display: flex;

        justify-content: space-around;

        margin-bottom: 10px;

    }

    button {

        width: 50px;

        height: 50px;

        border-radius: 10px;

        border: none;

        box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);

        cursor: pointer;

    }

    #score {

        font-size: 1.5em;

        margin-bottom: 10px;

    }

</style>

</head>

<body>

<div class="game-container">

    <div id="score">当前分数: 0</div>

    <div class="control-buttons">

        <button id="up-btn">&#9650;</button>

        <button id="right-btn">&#9654;</button>

        <button id="down-btn">&#9660;</button>

        <button id="left-btn">&#9664;</button>

    </div>

    <table id="game-board">

    </table>

</div>

 

<script>

    const board = document.getElementById('game-board');

    const scoreDisplay = document.getElementById('score');

 

    let snake = [{x: 10, y: 10}];

    let food = {x: 15, y: 15};

    let direction = 'right';

    let score = 0;

 

    function drawBoard() {

        board.innerHTML = '';

        for (let i = 0; i < 20; i++) {

            let row = '<tr>';

            for (let j = 0; j < 20; j++) {

                if (snake.some(part => part.x === j && part.y === i)) {

                    row += '<td class="snake"></td>';

                } else if (food.x === j && food.y === i) {

                    row += '<td class="food"></td>';

                } else {

                    row += '<td></td>';

                }

            }

            row += '</tr>';

            board.innerHTML += row;

        }

    }

 

    function updateSnake() {

        const head = {x: snake[0].x + (direction === 'right' ? 1 : direction === 'left' ? -1 : 0),

                      y: snake[0].y + (direction === 'down' ? 1 : direction === 'up' ? -1 : 0)};

        snake.unshift(head);

        if (head.x === food.x && head.y === food.y) {

            score++;

            scoreDisplay.textContent = `当前分数: ${score}`;

            food = {x: Math.floor(Math.random() * 20), y: Math.floor(Math.random() * 20)};

        } else {

            snake.pop();

        }

    }

 

    function checkCollision() {

        const head = snake[0];

        if (head.x < 0 || head.x >= 20 || head.y < 0 || head.y >= 20 || snake.slice(1).some(part => part.x === head.x && part.y === head.y)) {

            alert('Game Over!');

            location.reload();

        }

    }

 

    function gameLoop() {

        updateSnake();

        checkCollision();

        drawBoard();

        setTimeout(gameLoop, 200);

    }

 

    document.getElementById('up-btn').addEventListener('click', () => direction = 'up');

    document.getElementById('right-btn').addEventListener('click', () => direction = 'right');

    document.getElementById('down-btn').addEventListener('click', () => direction = 'down');

    document.getElementById('left-btn').addEventListener('click', () => direction = 'left');

 

    gameLoop();

</script>

</body>

</html>

http://www.yidumall.com/news/68075.html

相关文章:

  • 中央 政府网站建设 管理网站免费客服系统
  • 成全视频免费高清观看在线播放下载免费优化网站
  • 专卖店vi设计公司山西seo推广
  • 网站建设套模版个人网站免费域名和服务器
  • 网络营销方案简述橘子seo
  • 北京招聘信息武汉seo优化分析
  • 网络游戏网站开发网站app免费生成软件
  • 做男女的那个视频网站不受限制的搜索引擎
  • wordpress本地音乐播放器网络优化
  • 南通做网站网站网络推广运营
  • 学校网站改版网络推广费用高吗
  • 嘉定制作企业网站网站软文推广网站
  • wordpress做网站容易吗seo服务方案
  • qq自助下单平台网站阿里巴巴国际站
  • 做网站多少钱一张页面网上营销网站
  • dede 网站名称珠海百度seo
  • 莞城做网站长春百度快速优化
  • 网站封面怎么做吉林seo技术交流
  • 平阳网站制作谷歌关键词查询工具
  • 本地网站做通用会员卡百度学术搜索
  • 一站式做网站系统明天上海封控16个区
  • 网站建设在哪学城关网站seo
  • 服务器网站管理软件百度下载应用
  • 多语言网站建设费用百度官网登录
  • 湄潭建设局官方网站怎么找推广渠道
  • 襄阳手机网站建设app开发费用
  • 做网站优化的教程河北网站seo
  • wordpress post下载文件温州seo网站推广
  • 广州市网站建设制作费用114网址大全
  • 广东监理建设协会网站营销型网站建设套餐