欢迎来到程序小院
像素小鸟
玩法:
鼠标点击屏幕,小鸟上升,不点屏幕,小鸟下降。游戏目的,经过管子中间的缝隙^^
开始游戏
html
<div style="text-align:center;">
<canvas id="linkScreen"></canvas>
</div>
css
canvas {
position: relative;
border: 1px solid transparent;
background-clip: padding-box, border-box;
background-origin: padding-box, border-box;
background-image: linear-gradient(to right, #fff, #fff),
linear-gradient(120deg, #f7716d, #60C4FD, #EDC951, #7ac630,
#f7716d, #60C4FD, #EDC951, #7ac630,#7ac630, #f7716d, #60C4FD, #EDC951, #7ac630);
max-height: 100%;
display: block;
margin: 0 auto;
}
js
getButton: function(b) {
for (var d, e = D.length - 1; 0 <= e; e--) if (d = D[e], d.id == b) return d;
return null
},
appendButton: function(b) {
var d;
b && !this.getButton(b.id) && D.push(d = new this.Button(b));
return d
},
removeButton: function(b) {
for (var d, e = D.length - 1; 0 <= e; e--) if (d = D[e], d.id == b) {
D.splice(e, 1);
break
}
return this
},
clearButtons: function() {
D = [];
return this
},
actionButton: function(b, d, e) {
for (var f, g = D.length - 1; 0 <= g; g--) f = D[g],
f.collision(d, e, 1, 1, b);
return this
},
renderButton: function() {
for (var b, d = D.length - 1; 0 <= d; d--)(b = D[d]) && b.render();
return this
}
};
var B = g.canvas.screen.getDevice(),
x = {
bird: null,
bgType: 0,
isGameOver: !1,
bgColor: "#000",
bgX: 0,
bgY: 0,
bgImgW: 288,
bgImgH: 512,
bgWidth: 0,
bgHeight: 0,
speed: 0,
landX: 0,
landY: 0,
landW: 672,
landH: 112,
g: "android" == B && !C ? 0.7 : 1.5,
jumpSpeed: "android" == B && !C ? -8 : -12,
vy: 0,
obses: [],
obsDate: null,
obsTimeout: 1800,
obsFrameNum: 57,
obsCurrentFrame: 0,
obsState: "ready",
score: 0,
scoreObsId: "",
obsMapping: {
mp1: {
id: "s2",
sx: 112,
sy: 130,
width: 52,
height: 320
},
mp2: {
id: "s2",
sx: 168,
sy: 130,
width: 52,
height: 320
},
mp3: {
id: "s2",
sx: 0,
sy: 130,
width: 52,
height: 320
},
mp4: {
id: "s2",
sx: 56,
sy: 130,
width: 52,
height: 320
}
},
screenFlush: [],
birdSpriteId: 0,
bgId: 1,
源码
需要源码请关注添加好友哦^ ^
转载:欢迎来到本站,转载请注明文章出处https://ormcc.com/