Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
隱藏空白變更
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
文字樣式
變更外觀
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
9 年前
差異永不過期
清除
匯出
分享
解釋
9 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
209 行
全部複製
13 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
213 行
全部複製
var Game = function()
var Game = function()
{
{
this.bgLayers = {};
this.bgLayers = {};
this.barWidth = 530;
this.barWidth = 530;
this.init = false;
this.init = false;
this.queue = new createjs.LoadQueue(false, "assets/");
this.queue = new createjs.LoadQueue(false, "assets/");
this.queue.installPlugin(createjs.Sound);
this.queue.installPlugin(createjs.Sound);
this.queue.addEventListener("complete", createjs.proxy(this.run, this));
this.queue.addEventListener("complete", createjs.proxy(this.run, this));
this.queue.addEventListener("progress", function(e) { $("#loader").text("Loading: " + Math.round(e.progress * 100) + "%"); });
this.queue.addEventListener("progress", function(e) { $("#loader").text("Loading: " + Math.round(e.progress * 100) + "%"); });
createjs.Sound.alternateExtensions = ["mp3"];
createjs.Sound.alternateExtensions = ["mp3"];
createjs.Ticker.addEventListener("tick", createjs.proxy(this.tick, this));
createjs.Ticker.addEventListener("tick", createjs.proxy(this.tick, this));
};
};
Game.prototype =
Game.prototype =
{
{
load: function load()
load: function load()
{
{
this.queue.loadManifest([
this.queue.loadManifest([
{ id: "bg", src: "img/parallax-mountain-bg.png" },
{ id: "bg", src: "img/parallax-mountain-bg.png" },
{ id: "mountain", src: "img/parallax-mountain-montain-far.png" },
{ id: "mountain", src: "img/parallax-mountain-montain-far.png" },
{ id: "mountains", src: "img/parallax-mountain-mountains.png" },
{ id: "mountains", src: "img/parallax-mountain-mountains.png" },
{ id: "trees", src: "img/parallax-mountain-trees.png" },
{ id: "trees", src: "img/parallax-mountain-trees.png" },
{ id: "player-icon", src: "img/player-icon.png" },
{ id: "player-icon", src: "img/player-icon.png" },
{ id: "player", src: "img/player.png" },
{ id: "player", src: "img/player.png" },
{ id: "baddies", src: "img/baddies.png" },
{ id: "baddies", src: "img/baddies.png" },
{ id: "goal", src: "img/goal.png" },
{ id: "goal", src: "img/goal.png" },
{ id: "bgm", src: "bgm.ogg" }
{ id: "bgm", src: "bgm.ogg" }
]);
]);
},
},
run: function run()
run: function run()
{
{
$("#loader").remove();
$("#loader").remove();
$("#intro").css("display", "block");
$("#intro").css("display", "block");
複製
已複製
複製
已複製
createjs.Sound.play("bgm", { loop: -1 });
},
},
start: function start()
start: function start()
{
{
複製
已複製
複製
已複製
createjs.Sound.play("bgm", { loop: -1 });
$("#intro").remove();
$("#intro").remove();
$("#wrapper").css("display", "block");
$("#wrapper").css("display", "block");
this.baddies = 0;
this.baddies = 0;
this.player = {
this.player = {
distance: 250,
distance: 250,
strength: 1,
strength: 1,
food: 3,
food: 3,
water: 5
water: 5
}
}
this.sleeping = false;
this.sleeping = false;
this.stop = false;
this.stop = false;
this.bgLayers = {
this.bgLayers = {
bg: {
bg: {
x: 0,
x: 0,
y: -62,
y: -62,
speed: 25
speed: 25
},
},
mountain: {
mountain: {
x: 0,
x: 0,
y: -40,
y: -40,
speed: 50
speed: 50
},
},
mountains: {
mountains: {
x: 0,
x: 0,
y: -40,
y: -40,
speed: 75
speed: 75
},
},
trees: {
trees: {
x: 0,
x: 0,
y: -40,
y: -40,
speed: 100
speed: 100
}
}
};
};
$("#food-count").text(this.player.food);
$("#food-count").text(this.player.food);
$("#water-count").text(this.player.water);
$("#water-count").text(this.player.water);
$("#action-eat").click(this.eat.bind(this));
$("#action-eat").click(this.eat.bind(this));
$("#action-drink").click(this.drink.bind(this));
$("#action-drink").click(this.drink.bind(this));
$("#action-sleep").click(this.sleep.bind(this));
$("#action-sleep").click(this.sleep.bind(this));
複製
已複製
複製
已複製
$("#message").empty();
$("#player").css("animation", "play .5s steps(2) infinite");
this.init = true;
this.init = true;
},
},
tick: function tick(e)
tick: function tick(e)
{
{
if (this.stop || !this.init)
if (this.stop || !this.init)
return;
return;
if (this.sleeping)
if (this.sleeping)
this.player.strength = this.addStrength(e.delta / 8000);
this.player.strength = this.addStrength(e.delta / 8000);
else
else
this.player.strength -= e.delta / 60000;
this.player.strength -= e.delta / 60000;
if (this.player.strength <= 0)
if (this.player.strength <= 0)
{
{
$("#strength-bar").width(0);
$("#strength-bar").width(0);
$("#player").css("animation", "die .5s steps(4) forwards");
$("#player").css("animation", "die .5s steps(4) forwards");
複製
已複製
複製
已複製
this.showMsg(
"
You died of exhaustion!
"
);
this.showMsg(
'
You died of exhaustion!
<br/><p class="action" onclick="javascript:game.start()">Restart</p>'
);
this.stop = true;
this.stop = true;
}
}
else
else
{
{
$("#strength-bar").width(this.barWidth * this.player.strength);
$("#strength-bar").width(this.barWidth * this.player.strength);
if (!this.sleeping)
if (!this.sleeping)
{
{
for (var i in this.bgLayers)
for (var i in this.bgLayers)
{
{
this.bgLayers[i].x -= this.bgLayers[i].speed / e.delta * this.player.strength;
this.bgLayers[i].x -= this.bgLayers[i].speed / e.delta * this.player.strength;
$("#" + i).css("background-position", this.bgLayers[i].x + "px " + this.bgLayers[i].y + "px");
$("#" + i).css("background-position", this.bgLayers[i].x + "px " + this.bgLayers[i].y + "px");
}
}
this.player.distance += 2.5 * (e.delta / 60) * this.player.strength;
this.player.distance += 2.5 * (e.delta / 60) * this.player.strength;
}
}
this.baddies += 2.5 * (e.delta / 60) * 0.75;
this.baddies += 2.5 * (e.delta / 60) * 0.75;
$("#player-icon").css("left", (this.player.distance / 10) + "px");
$("#player-icon").css("left", (this.player.distance / 10) + "px");
$("#baddies").css("left", (this.baddies / 10) + "px");
$("#baddies").css("left", (this.baddies / 10) + "px");
if (this.baddies >= this.player.distance)
if (this.baddies >= this.player.distance)
{
{
複製
已複製
複製
已複製
this.player.
strength
= 0
;
$("#
strength
-bar").width(0);
this.showMsg(
"
You got caught!
");
$("#player").css("animation", "die .5s steps(4) forwards")
;
this.showMsg(
'
You got caught!
<br/><p class="action" onclick="javascript:game.start()">Restart</p>');
this.stop = true;
}
}
else if (this.player.distance > 7700)
else if (this.player.distance > 7700)
{
{
複製
已複製
複製
已複製
this.showMsg(
"
You made it!
"
);
this.showMsg(
'
You made it!
<br/><p class="action" onclick="javascript:game.start()">Restart</p>'
);
this.stop = true;
this.stop = true;
$("#player").css("animation", "none");
$("#player").css("animation", "none");
}
}
}
}
},
},
eat: function eat()
eat: function eat()
{
{
if (this.player.strength <= 0 || this.sleeping)
if (this.player.strength <= 0 || this.sleeping)
return;
return;
if (this.player.food > 0)
if (this.player.food > 0)
{
{
this.player.strength = this.addStrength(0.4);
this.player.strength = this.addStrength(0.4);
this.player.food--;
this.player.food--;
$("#food-count").text(this.player.food);
$("#food-count").text(this.player.food);
}
}
else
else
this.showMsg("No food left!", 2000);
this.showMsg("No food left!", 2000);
},
},
drink: function drink()
drink: function drink()
{
{
if (this.player.strength <= 0 || this.sleeping)
if (this.player.strength <= 0 || this.sleeping)
return;
return;
if (this.player.water > 0)
if (this.player.water > 0)
{
{
this.player.strength = this.addStrength(0.2);
this.player.strength = this.addStrength(0.2);
this.player.water--;
this.player.water--;
$("#water-count").text(this.player.water);
$("#water-count").text(this.player.water);
}
}
else
else
this.showMsg("No water left!", 2000);
this.showMsg("No water left!", 2000);
},
},
sleep: function sleep()
sleep: function sleep()
{
{
if (this.player.strength <= 0 || this.sleeping)
if (this.player.strength <= 0 || this.sleeping)
return;
return;
this.sleeping = true;
this.sleeping = true;
$("#world").animate({ opacity: 0 }, 500, function() {
$("#world").animate({ opacity: 0 }, 500, function() {
//this.baddies += 25;
//this.baddies += 25;
setTimeout(function() {
setTimeout(function() {
$("#world").animate({ opacity: 1 }, 500, function() {
$("#world").animate({ opacity: 1 }, 500, function() {
this.sleeping = false;
this.sleeping = false;
}.bind(this));
}.bind(this));
}.bind(this), 2000);
}.bind(this), 2000);
}.bind(this));
}.bind(this));
//this.player.strength = this.addStrength(0.75);
//this.player.strength = this.addStrength(0.75);
},
},
addStrength: function addStrength(v)
addStrength: function addStrength(v)
{
{
var s = this.player.strength + v;
var s = this.player.strength + v;
return (s > 1 ? 1 : s);
return (s > 1 ? 1 : s);
},
},
showMsg: function showMsg(msg, timeout)
showMsg: function showMsg(msg, timeout)
{
{
$("#message").html(msg);
$("#message").html(msg);
if (timeout)
if (timeout)
{
{
window.clearTimeout(window.timeoutID);
window.clearTimeout(window.timeoutID);
window.timeoutID = setTimeout(function() { $("#message").empty(); }, timeout)
window.timeoutID = setTimeout(function() { $("#message").empty(); }, timeout)
}
}
}
}
};
};
已保存差異
原始文本
開啟檔案
var Game = function() { this.bgLayers = {}; this.barWidth = 530; this.init = false; this.queue = new createjs.LoadQueue(false, "assets/"); this.queue.installPlugin(createjs.Sound); this.queue.addEventListener("complete", createjs.proxy(this.run, this)); this.queue.addEventListener("progress", function(e) { $("#loader").text("Loading: " + Math.round(e.progress * 100) + "%"); }); createjs.Sound.alternateExtensions = ["mp3"]; createjs.Ticker.addEventListener("tick", createjs.proxy(this.tick, this)); }; Game.prototype = { load: function load() { this.queue.loadManifest([ { id: "bg", src: "img/parallax-mountain-bg.png" }, { id: "mountain", src: "img/parallax-mountain-montain-far.png" }, { id: "mountains", src: "img/parallax-mountain-mountains.png" }, { id: "trees", src: "img/parallax-mountain-trees.png" }, { id: "player-icon", src: "img/player-icon.png" }, { id: "player", src: "img/player.png" }, { id: "baddies", src: "img/baddies.png" }, { id: "goal", src: "img/goal.png" }, { id: "bgm", src: "bgm.ogg" } ]); }, run: function run() { $("#loader").remove(); $("#intro").css("display", "block"); }, start: function start() { createjs.Sound.play("bgm", { loop: -1 }); $("#intro").remove(); $("#wrapper").css("display", "block"); this.baddies = 0; this.player = { distance: 250, strength: 1, food: 3, water: 5 } this.sleeping = false; this.stop = false; this.bgLayers = { bg: { x: 0, y: -62, speed: 25 }, mountain: { x: 0, y: -40, speed: 50 }, mountains: { x: 0, y: -40, speed: 75 }, trees: { x: 0, y: -40, speed: 100 } }; $("#food-count").text(this.player.food); $("#water-count").text(this.player.water); $("#action-eat").click(this.eat.bind(this)); $("#action-drink").click(this.drink.bind(this)); $("#action-sleep").click(this.sleep.bind(this)); this.init = true; }, tick: function tick(e) { if (this.stop || !this.init) return; if (this.sleeping) this.player.strength = this.addStrength(e.delta / 8000); else this.player.strength -= e.delta / 60000; if (this.player.strength <= 0) { $("#strength-bar").width(0); $("#player").css("animation", "die .5s steps(4) forwards"); this.showMsg("You died of exhaustion!"); this.stop = true; } else { $("#strength-bar").width(this.barWidth * this.player.strength); if (!this.sleeping) { for (var i in this.bgLayers) { this.bgLayers[i].x -= this.bgLayers[i].speed / e.delta * this.player.strength; $("#" + i).css("background-position", this.bgLayers[i].x + "px " + this.bgLayers[i].y + "px"); } this.player.distance += 2.5 * (e.delta / 60) * this.player.strength; } this.baddies += 2.5 * (e.delta / 60) * 0.75; $("#player-icon").css("left", (this.player.distance / 10) + "px"); $("#baddies").css("left", (this.baddies / 10) + "px"); if (this.baddies >= this.player.distance) { this.player.strength = 0; this.showMsg("You got caught!"); } else if (this.player.distance > 7700) { this.showMsg("You made it!"); this.stop = true; $("#player").css("animation", "none"); } } }, eat: function eat() { if (this.player.strength <= 0 || this.sleeping) return; if (this.player.food > 0) { this.player.strength = this.addStrength(0.4); this.player.food--; $("#food-count").text(this.player.food); } else this.showMsg("No food left!", 2000); }, drink: function drink() { if (this.player.strength <= 0 || this.sleeping) return; if (this.player.water > 0) { this.player.strength = this.addStrength(0.2); this.player.water--; $("#water-count").text(this.player.water); } else this.showMsg("No water left!", 2000); }, sleep: function sleep() { if (this.player.strength <= 0 || this.sleeping) return; this.sleeping = true; $("#world").animate({ opacity: 0 }, 500, function() { //this.baddies += 25; setTimeout(function() { $("#world").animate({ opacity: 1 }, 500, function() { this.sleeping = false; }.bind(this)); }.bind(this), 2000); }.bind(this)); //this.player.strength = this.addStrength(0.75); }, addStrength: function addStrength(v) { var s = this.player.strength + v; return (s > 1 ? 1 : s); }, showMsg: function showMsg(msg, timeout) { $("#message").html(msg); if (timeout) { window.clearTimeout(window.timeoutID); window.timeoutID = setTimeout(function() { $("#message").empty(); }, timeout) } } };
更改後文本
開啟檔案
var Game = function() { this.bgLayers = {}; this.barWidth = 530; this.init = false; this.queue = new createjs.LoadQueue(false, "assets/"); this.queue.installPlugin(createjs.Sound); this.queue.addEventListener("complete", createjs.proxy(this.run, this)); this.queue.addEventListener("progress", function(e) { $("#loader").text("Loading: " + Math.round(e.progress * 100) + "%"); }); createjs.Sound.alternateExtensions = ["mp3"]; createjs.Ticker.addEventListener("tick", createjs.proxy(this.tick, this)); }; Game.prototype = { load: function load() { this.queue.loadManifest([ { id: "bg", src: "img/parallax-mountain-bg.png" }, { id: "mountain", src: "img/parallax-mountain-montain-far.png" }, { id: "mountains", src: "img/parallax-mountain-mountains.png" }, { id: "trees", src: "img/parallax-mountain-trees.png" }, { id: "player-icon", src: "img/player-icon.png" }, { id: "player", src: "img/player.png" }, { id: "baddies", src: "img/baddies.png" }, { id: "goal", src: "img/goal.png" }, { id: "bgm", src: "bgm.ogg" } ]); }, run: function run() { $("#loader").remove(); $("#intro").css("display", "block"); createjs.Sound.play("bgm", { loop: -1 }); }, start: function start() { $("#intro").remove(); $("#wrapper").css("display", "block"); this.baddies = 0; this.player = { distance: 250, strength: 1, food: 3, water: 5 } this.sleeping = false; this.stop = false; this.bgLayers = { bg: { x: 0, y: -62, speed: 25 }, mountain: { x: 0, y: -40, speed: 50 }, mountains: { x: 0, y: -40, speed: 75 }, trees: { x: 0, y: -40, speed: 100 } }; $("#food-count").text(this.player.food); $("#water-count").text(this.player.water); $("#action-eat").click(this.eat.bind(this)); $("#action-drink").click(this.drink.bind(this)); $("#action-sleep").click(this.sleep.bind(this)); $("#message").empty(); $("#player").css("animation", "play .5s steps(2) infinite"); this.init = true; }, tick: function tick(e) { if (this.stop || !this.init) return; if (this.sleeping) this.player.strength = this.addStrength(e.delta / 8000); else this.player.strength -= e.delta / 60000; if (this.player.strength <= 0) { $("#strength-bar").width(0); $("#player").css("animation", "die .5s steps(4) forwards"); this.showMsg('You died of exhaustion!<br/><p class="action" onclick="javascript:game.start()">Restart</p>'); this.stop = true; } else { $("#strength-bar").width(this.barWidth * this.player.strength); if (!this.sleeping) { for (var i in this.bgLayers) { this.bgLayers[i].x -= this.bgLayers[i].speed / e.delta * this.player.strength; $("#" + i).css("background-position", this.bgLayers[i].x + "px " + this.bgLayers[i].y + "px"); } this.player.distance += 2.5 * (e.delta / 60) * this.player.strength; } this.baddies += 2.5 * (e.delta / 60) * 0.75; $("#player-icon").css("left", (this.player.distance / 10) + "px"); $("#baddies").css("left", (this.baddies / 10) + "px"); if (this.baddies >= this.player.distance) { $("#strength-bar").width(0); $("#player").css("animation", "die .5s steps(4) forwards"); this.showMsg('You got caught!<br/><p class="action" onclick="javascript:game.start()">Restart</p>'); this.stop = true; } else if (this.player.distance > 7700) { this.showMsg('You made it!<br/><p class="action" onclick="javascript:game.start()">Restart</p>'); this.stop = true; $("#player").css("animation", "none"); } } }, eat: function eat() { if (this.player.strength <= 0 || this.sleeping) return; if (this.player.food > 0) { this.player.strength = this.addStrength(0.4); this.player.food--; $("#food-count").text(this.player.food); } else this.showMsg("No food left!", 2000); }, drink: function drink() { if (this.player.strength <= 0 || this.sleeping) return; if (this.player.water > 0) { this.player.strength = this.addStrength(0.2); this.player.water--; $("#water-count").text(this.player.water); } else this.showMsg("No water left!", 2000); }, sleep: function sleep() { if (this.player.strength <= 0 || this.sleeping) return; this.sleeping = true; $("#world").animate({ opacity: 0 }, 500, function() { //this.baddies += 25; setTimeout(function() { $("#world").animate({ opacity: 1 }, 500, function() { this.sleeping = false; }.bind(this)); }.bind(this), 2000); }.bind(this)); //this.player.strength = this.addStrength(0.75); }, addStrength: function addStrength(v) { var s = this.player.strength + v; return (s > 1 ? 1 : s); }, showMsg: function showMsg(msg, timeout) { $("#message").html(msg); if (timeout) { window.clearTimeout(window.timeoutID); window.timeoutID = setTimeout(function() { $("#message").empty(); }, timeout) } } };
尋找差異