重启画布老虎机游戏

时间:2018-03-22 10:34:22

标签: javascript html

我做了一个老虎机游戏,有3个按钮,播放,停止,刷新..播放按钮开始旋转,停止按钮停止旋转所选图像,我只需要添加一个刷新按钮来刷新游戏,像它一样重新启动窗口刚刚打开。

<div id="buttons">
  <div id="play" class="butn butn--stripe">spin</div>
  <div id="setStopAt" class="butn butn--stripe">stop</div>
  <div id="refresh" class="butn butn--stripe">refresh</div>
</div>

按钮的html声明

Game.prototype.restart = function() {
  this.lastUpdate = new Date();
  this.speed1 = this.speed2 = this.speed3 = SLOT_SPEED
  // function locates id from items
  function _find(items, id) {
    for (var i = 0; i < items.length; i++) {
      if (items[i].id == id) 
        return i;
      }
    }    
    // Clear stop locations
    this.stopped1 = false;
    this.stopped2 = false;
    this.stopped3 = false;
    // randomize reel locations
    this.offset1 = -parseInt(Math.random(ITEM_COUNT)) * SLOT_HEIGHT;
    this.offset2 = -parseInt(Math.random(ITEM_COUNT)) * SLOT_HEIGHT;
    this.offset3 = -parseInt(Math.random(ITEM_COUNT)) * SLOT_HEIGHT;

    $('#results').hide();
    game.increaseSpeed();
    this.state = 2;
}

1 个答案:

答案 0 :(得分:0)

如果你没有完全重启,那么将GOBIN = C:\Go\bin绑定到你的重启按钮可能是你最好的选择。否则这可能会有所帮助;

this

相关问题