小编Ant*_*sma的帖子

在本地存储中设置变量

目前正在设计游戏并且想法是高分,因此当当前得分超过本地存储时,它将被替换:

localStorage.setItem('highScore', highScore);
var HighScore = localStorage.getItem('highScore');
if (HighScore == null || HighScore == "null") {
  HighScore = 0;
}

if (user.points > HighScore) {
  highScore = parseInt(HighScore);
}
return highScore 
Run Code Online (Sandbox Code Playgroud)

多谢你们

javascript html5 local-storage 2d-games

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

2d-games ×1

html5 ×1

javascript ×1

local-storage ×1