7.猜牌接龙.rar

  • `chengyu
    了解作者
  • JavaScript
    开发工具
  • 13KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2021-03-09 20:24
    上传日期
自己开发的html接龙游戏,规则与Windows系统自带的接龙有些相似,不同之处主要是多了4张猜对了才能用的牌,在游戏界面中用问号标出
7.猜牌接龙.rar
  • 7.猜牌接龙
  • GuessSolitaire
  • .idea
  • modules.xml
    287B
  • GuessSolitaire.iml
    469B
  • workspace.xml
    8.3KB
  • poker.js
    28.5KB
  • index.html
    52.5KB
内容介绍
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>猜牌接龙</title> <style> #guessDiv { display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); } </style> </head> <body bgcolor="green"> <div id="container"> &nbsp; </div> <div id="guessDiv"> <div id="title">猜一猜这4张是什么牌</div> <br> <div> <select id="select_suit1"> <option value="spades">黑桃</option> <option value="hearts">红桃</option> <option value="diamonds">方片</option> <option value="clubs">梅花</option> </select> <select id="select_point1"> <option value="a">A</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="j">J</option> <option value="q">Q</option> <option value="k">K</option> </select> </div> <div> <select id="select_suit2"> <option value="spades">黑桃</option> <option value="hearts">红桃</option> <option value="diamonds">方片</option> <option value="clubs">梅花</option> </select> <select id="select_point2"> <option value="a">A</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="j">J</option> <option value="q">Q</option> <option value="k">K</option> </select> </div> <div> <select id="select_suit3"> <option value="spades">黑桃</option> <option value="hearts">红桃</option> <option value="diamonds">方片</option> <option value="clubs">梅花</option> </select> <select id="select_point3"> <option value="a">A</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="j">J</option> <option value="q">Q</option> <option value="k">K</option> </select> </div> <div> <select id="select_suit4"> <option value="spades">黑桃</option> <option value="hearts">红桃</option> <option value="diamonds">方片</option> <option value="clubs">梅花</option> </select> <select id="select_point4"> <option value="a">A</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="j">J</option> <option value="q">Q</option> <option value="k">K</option> </select> </div> <br> <button id="confirm">确定</button> <button id="cancel">取消</button> </div> </body> <script src="./poker.js"></script> <script> if (window.Poker) { init(); function init() { var container = document.getElementById('container'); var domCanvas = document.createElement('canvas'); var canvas = domCanvas.getContext('2d'); container.appendChild(domCanvas); domCanvas.height = 600; domCanvas.width = 1300; var cardWidth = 60; var cardHeight = 80; var suits = ['spades', 'hearts', 'diamonds', 'clubs']; var points = ['a', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'j', 'q', 'k']; var cards = []; for (var i = 0; i < 4; i++) { for (var j = 0; j < 13; j++) { cards.push([suits[i], points[j]]); } } // 模拟洗牌,打乱52张牌的顺序 for (var i = 0; i < 10; i++) { cards.sort(function () { return Math.random() - 0.5; }); } var guessCards = []; var guessed = []; var deskCards = []; for (var i = 0; i < 9; i++) deskCards.push([]); var successedCards = [[], [], [], []]; // 下发并绘制要猜的4张牌 for (var i = 0; i < 4; i++) { guessCards.push([cards[i][0], cards[i][1]]); canvas.drawPokerBack(400, 110 + 100 * i, cardHeight, '#5C72C2', '#2B4299'); } for (var i = 0; i < 4; i++) { canvas.font = '60px "微软雅黑"'; canvas.fillStyle = 'yellow'; canvas.fillText('?', 415, 174 + 100 * i); } // 下发并绘制明牌 for (var i = 0; i < 9; i++) { deskCards[i].push([cards[i + 4][0], cards[i + 4][1]]); canvas.drawPokerCard(540 + 140 * (i % 3), 110 + 150 * Math.floor(i / 3), cardHeight, cards[i + 4][0], cards[i + 4][1]); } cards.splice(0, 13); // 绘制右上方四个置牌点 canvas.strokeStyle = '#FFF'; canvas.lineWidth = 2; for (var i = 0; i < 4; i++) { canvas.strokeRect(580 + 80 * i, 10, cardWidth, cardHeight); } var allowOperate = true; var selected = null; domCanvas.addEventListener('click', function (e) { if (allowOperate) { allowOperate = false; if (selected) { // 若当前已选中了牌则按规则移动 var dragon = []; if (selected.area === 'guess') dragon.push(guessCards[selected.pos]); else if (selected.area === 'desk') { for (var i = selected.fromIndex; i < deskCards[selected.pos].length; i++) dragon.push(deskCards[selected.pos][i]); } else dragon.push(successedCards[selected.pos][successedCards[selected.pos].length - 1]); // 点击明牌 var len; if (e.x >= 556 && e.x < 556 + cardWidth && e.y >= 120 && e.y < 180 + cardHeight) { len = deskCards[0].length; if (!(len === 0 || len === 1 && e.y >= 120 + cardHeight || len === 2 && e.y >= 150 + cardHeight || selected.area === 'desk' && selected.pos === 0) && allowMove(dragon, 0)) move(dragon, 0); selected
评论
    相关推荐
    • GAME.COM_EMULATOR.zip
      This is not mine, I don't even know what it is. Looks like a emulator for something.
    • jQuizShow (Millionaire game)-开源
      jQuizShow 基于流行的“谁想成为百万富翁”电视游戏节目。 它形成了一个框架,一个群体可以围绕这个框架玩他们自己的类似百万富翁的游戏。 可定制,很容易添加您自己的问题和答案。 Java 1.3.1+
    • SolitareJs:Jenkins课程回购克隆
      SolitareJs:Jenkins课程回购克隆
    • snowglobe-src-viewer-2.0.0-r0.tar.gz
      国外的开源游戏引擎,能够承载上千人,属于社交类的游戏
    • 彩球射手.rar
      该游戏适合于平时娱乐之用,娱乐时只需将大于等于三个的连在一块就得分,直到最地层触底为止.
    • 是男人就下一百层SHY.rar
      制作的第一款休闲类的手机游戏,适合初学者参考
    • Java拼图游戏源码.rar
      Java拼图游戏源码,挺经典是一个源码,内附解压密码
    • UnrealEngine3.tar.gz
      虚幻引擎3(UnrealEngine3)源代码,包含编辑器和引擎部分的源代码。比较完整。
    • Sudoku.zip
      数独题集 分上下册,上册为120道数独题,下册为答案 提高智力的最简单方式
    • Engine_v0.2.tar.gz
      一个巨cool的3D游戏引擎源代码。其0.3版本开始收费,卖10000美金,其功能有bsp/portal,particle system,physics,skelet-animation,energe unit,lod.四叉树/八叉树,shaders(glsl/hlsl)