在本地保存增量游戏

时间:2014-06-08 10:06:55

标签: javascript

我试图让我的增量游戏在本地保存Cookie /数据,但我不知道该怎么做..这就是HTML和Javascript。

使用Javascript:

    saveGame() = function() {
    saveService.saveGame();
    }

    resetGame() = function() {
    localStorage.clear();
    }

HTML:

                    <section><center>
                        <p>The game auto-saves every 30 seconds, but in case you are in a hurry, use this:</p><br />
                        <a class="button12" ng-click="saveGame()"/>Save Game</a>
                        <br /><br />
                    </center></section>
                        <hr>
                    <section><center>
                        <p>This will <strong>permanently</strong> reset your game (refresh after you press it):</p><br />
                        <a class="button12" ng-click="resetGame()">Reset Game</a>
                        <br /><br />
                    </center></section>

除了保存游戏外,我还希望能够让游戏重置。我怎么能这样做?

0 个答案:

没有答案