本文主要是介绍密室逃脱小游戏,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
欢迎来到程序小院
密室逃脱
玩法:
判断可生存的空间,鼠标点击屏幕进行人物左右移动,躲避闸道进行生存,每进行一次关卡都会有分数统计,赶紧去闯关吧^^。
开始游戏https://www.ormcc.com/play/gameStart/176
html
<canvas id="jsGameScreen"></canvas>
css
.bandiv{float:left; width:100%; background-color:#DBD1BB;
}
.bandiv div{padding:10px; text-align:left;
}
#play68box{width: 190px;font-size: 12px;line-height: 15px;right: -172px;top: 35%;position: fixed;z-index: 100;
}#tab{float: left;list-style: none outside none;padding: 0;position: relative;z-index: 99;margin-top: 10px;margin-right: 0;margin-bottom: 0;margin-left: 0;
}#tab li span{display: block;padding: 0 5px;position: relative;
}#links{width: 100px;padding: 1px;float: left;background-color: #f6bb42;border-radius: 8px;
}
js
e.showClue = function() {window.scrollTo(0, -5);e.ctx.fillStyle = "#ffffff";e.ctx.fillRect(0, 0, window.innerWidth, window.innerHeight);t.canvas.drawImage("h", (window.innerWidth - 153) / 2, (window.innerHeight - 122) / 2)
};
var u = {x: (t.canvas.screen.getWidth() - 126) / 2,y: 180,w: 126,h: 35,isPressed: !1,draw: n
},
a = {x: (t.canvas.screen.getWidth() - 126) / 2,y: 260,w: 126,h: 35,isPressed: !1,draw: n
},
f = {x: (t.canvas.screen.getWidth() - 126) / 2,y: 660,w: 126,h: 35,isPressed: !1,draw: n
},
l = {x: (t.canvas.screen.getWidth() - 126) / 2,y: 740,w: 126,h: 35,isPressed: !1,draw: n
},
c = {x: (t.canvas.screen.getWidth() - 126) / 2,y: 660,w: 126,h: 35,isPressed: !1,draw: n
},
h = {x: (t.canvas.screen.getWidth() - 126) / 2,y: 740,w: 126,h: 35,isPressed: !1,draw: n
},
p = {jianRenStateType: {normal: 0,died: 1,stop: 2},jianRenDirection: {center: 0,left: 1,right: 2}
},
v = {baseY: 0,mission: 0,wall: {width: 30,topWallY: -150,bottomWallY: 0,timeout: 1e3,gapTimeout: 1e3,dropped: !1,tiles: {top: [],bottom: []}},jianren: {index: 0,y: 0,width: 30,height: 38,state: p.jianRenStateType.normal,direction: p.jianRenDirection.center,showAction: !1}
},
m,
g,
y,
b,
w,
E,
S = [20, 35, 50, 25],
x,
T = function(e) {if (0 < e) {switch (e) {case 10:y = 3;v.wall.timeout = 500;break;case 20:y = 2;v.wall.timeout = 350;break;case 30:y = 1;v.wall.timeout = 225;break;case 40:v.wall.timeout = 100;break;case 50:v.wall.timeout = 50}for (b = []; b.length < y;) if (w = t.commandFuns.getRandom(0, parseInt(t.canvas.screen.getWidth() / 2 / v.wall.width) - 1), 0 == b.length) b.push(w);else {E = !0;for (e = 0; e < b.length; e++) w == b[e] && (E = !1);E && b.push(w)}var n;v.wall.tiles.top = [];v.wall.tiles.bottom = [];for (e = 0; e < parseInt(t.canvas.screen.getWidth() / 2 / v.wall.width);e++) n = t.commandFuns.getRandom(220, 280),v.wall.tiles.top.push({height: n}),v.wall.tiles.bottom.push({height: t.canvas.screen.getHeight() - n});for (e = 0; e < b.length; e++) v.wall.tiles.top[b[e]].height -= S[t.commandFuns.getRandom(0, S.length - 1)]} else v.wall.tiles = {top: [{height: 250},{height: 250},{height: 250},{height: 250},{height: 215},{height: 250},{height: 250},{height: 250}],bottom: [{height: 70},{height: 70},{height: 70},{height: 70},{height: 70},{height: 70},{height: 70},{height: 70}]};m = [];for (e = 0; e < v.wall.tiles.top.length; e++) m.push({sx: e * v.wall.width,sy: v.baseY + v.wall.tiles.top[e].height,ex: (e + 1) * v.wall.width,ey: v.baseY + v.wall.tiles.top[e].height});g = [];for (e = 0; e < v.wall.tiles.bottom.length; e++) g.push({sx: e * v.wall.width,sy: v.baseY + t.canvas.screen.getHeight() - v.wall.tiles.bottom[e].height,ex: (e + 1) * v.wall.width,ey: v.baseY + t.canvas.screen.getHeight() - v.wall.tiles.bottom[e].height});v.wall.topWallY = -150;v.wall.bottomWallY = 0;v.wall.timeout = 1e3;v.wall.gapTimeout = 800;v.wall.dropped = !1;v.jianren.index = 4;v.jianren.y = 150;v.jianren.state = p.jianRenStateType.normal;v.jianren.showAction = !1;x = t.commandFuns.getRandom(0, 1)
},
N = 0,
C,
k,
L = 5,
A = 0,
O = 1,
M = 2,
_ = 3,
D = 0,
P = "",
H = 0,
P = "CHS",
D = null == P ? L: A,
H = t.localStorage.getItem("highScore2");
null == H && (H = 0);
updateShareScore(H);
var B = function() {N = 0;v.mission = 1;y = 3;v.jianren.direction = p.jianRenDirection.center;C = 0;k = 105;T(v.mission)
},
j = function() {t.canvas.drawImage("bl1", 0, 0, t.getImage("bl1").width, t.getImage("bl1").height, 0, 0, t.canvas.screen.getWidth(), t.canvas.screen.getHeight())
},
F = [],
I = 0,
q = [],
R,
U = 0,
z = [{sx: 0,sy: 0
},
{sx: 30,sy: 0
}],
W = 0,
X = [{sx: 60,sy: 0
},
{sx: 60,sy: 0
},
{sx: 90,sy: 0
},
{sx: 90,sy: 0
},
{sx: 120,sy: 0
},
{sx: 120,sy: 0
},
{sx: 150,sy: 0
},
{sx: 150,sy: 0
},
{sx: 180,sy: 0
},
{sx: 180,sy: 0
}],
V,
$ = [0, 1],
J = [2, 3],
K = 0,
Q = [{sx: 0,sy: 0
},
{sx: 30,sy: 0
},
{sx: 60,sy: 0
},
{sx: 90,sy: 0
},
{sx: 120,sy: 0
}],
G = 0,
Y = function(e, n) {6 > G ? (t.canvas.drawImage("han1", 20 * parseInt(G), 0, 20, 17, 2 * (e + 15), 2 * n, 40, 34), G += .5) : 12 > G && (t.canvas.drawImage("han2", 20 * parseInt(G - 6), 0, 20, 17, 2 * (e - 5), 2 * n, 40, 34),G += .5, G %= 12)
},
Z = [],
et = [],
tt,
nt = function(e, n, r) {t.canvas.beginPath();t.canvas.lineWidth(2 * (n + 2)).strokeStyle("#000000");for (var i = 0; i < e.length; i++) 0 == i ? t.canvas.moveTo(2 * e[i].sx, 2 * (r + e[i].sy)) : t.canvas.lineTo(2 * e[i].sx, 2 * (r + e[i].sy)),t.canvas.lineTo(2 * e[i].ex, 2 * (r + e[i].ey));t.canvas.stroke();t.canvas.lineWidth(2 * n).strokeStyle("#00FF00");for (i = 0; i < e.length; i++) 0 == i ? t.canvas.moveTo(2 * e[i].sx,2 * (r + e[i].sy)) : t.canvas.lineTo(2 * e[i].sx, 2 * (r + e[i].sy)),t.canvas.lineTo(2 * e[i].ex, 2 * (r + e[i].ey));t.canvas.stroke().closePath().lineWidth(2)
},
rt = 0,
it = {x: 0,y: 0
};
t.events.touchStart(function(e) {it = {x: e.touches[0].clientX,y: e.touches[0].clientY};i(it)
}).touchMove(function(e) {it = {x: e.touches[0].clientX,y: e.touches[0].clientY};s(it)
}).touchEnd(function(e) {o(it)
}).mouseMove(function(t) {it = {x: t.clientX - e.left,y: t.clientY - e.top};s(it)
}).mouseDown(function(t) {it = {x: t.clientX - e.left,y: t.clientY - e.top};i(it)
}).mouseUp(function(t) {it = {x: t.clientX - e.left,y: t.clientY - e.top};o(it)
});
},
源码https://www.ormcc.com/
需要源码请关注添加好友哦^ ^
转载:欢迎来到本站,转载请注明文章出处
https://ormcc.com/
这篇关于密室逃脱小游戏的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!