欢迎来到程序小院
飞越天空之城
玩法:左边的按钮是控制小人儿飞起来的方向的,右边的按钮是控制它飞的高度的,
左边控制在正上方时可以让小人儿沿着一个方向飞跃,否则会撞到两边的黑墙,
右边的按钮如果加足够的话,会让你的小人儿飞的更高哦^^。
开始游戏
html
<canvas id="gameCanvas" width="320" ></canvas>
css
*{margin:0;padding:0;
}
body,div{text-align:center;
}
img {max-width:100%;height:auto;width:auto9;
}
js
function e(c) {throw c;
}
var m = void 0,
q = !0,
s = null,
t = !1;
function da() {return function(c) {return c}
}
function u() {return function() {}
}
function x(c) {return function(d) {this[c] = d}
}
function A(c) {return function() {return this[c]}
}
function B(c) {return function() {return c}
}
var C = C || {};
C.U = C.U || {};
C.n = {};
H = window;
H = Object.prototype;
delete window._p;
C.bd = function(c) {return document.createElement(c)
};
C.qb = function(c, d, f, g) {c.addEventListener(d, f, g)
};
C.iaa = "undefined" !== typeof require && require("fs");
C.pda = function(c, d) {if (c) if (c instanceof Array) for (var f = 0,g = c.length; f < g && d.call(m, c[f], f) !== t; f++);else for (f in c) if (d.call(m, c[f], f) === t) break
};
C.g1 = function(c) {if (!c) return C.log("invalid URL"),t;var d = c.indexOf("://");if ( - 1 == d) return t;d = c.indexOf("/", d + 3);return ( - 1 == d ? c: c.substring(0, d)) != location.origin
};
C.async = {B9: function(c) {var d = this.Uca;if (!d.d0) {var f = d.length,g = d.$ga,h = d.ega,k = h.mg,n = h.Nca,p = h.O3,h = h.z6a;if (c) {if (d.d0 = c, k) return k.call(n, c)} else {var r = Array.apply(s, arguments).slice(1),v = r.length;0 == v ? r = s: 1 == v && (r = r[0]);g[this.index] = r;d.count--;p && p.call(h, r, f - d.count, f);0 == d.count && k && k.apply(n, [s, g])}}},s$: u(),X0a: function(c, d, f) {var g = C.async;f !== m ? ("function" == typeof d && (d = {O3: d}), d.mg = f || d.mg) : d !== m ? "function" == typeof d && (d = {mg: d}) : c !== m ? d = {}: e("arguments error!");var h = (f = c instanceof Array) ? c.length: Object.keys(c).length;if (0 == h) d.mg && d.mg.call(d.Nca, s);else {var k = {length: h,count: h,ega: d,$ga: f ? [] : {}};C.pda(c,function(c, f) {if (k.d0) return t;var h = !d.mg && !d.O3 ? g.s$: g.B9.bind({Uca: k,index: f});c(h, f)})}},map: function(c, d, f) {var g = this,h = arguments.length;"function" == typeof d && (d = {n1: d});3 === h ? d.mg = f || d.mg: 2 > h && e("arguments error!");"function" == typeof d && (d = {n1: d});f !== m ? d.mg = f || d.mg: c === m && e("arguments error!");var k = (h = c instanceof Array) ? c.length: Object.keys(c).length;if (0 === k) d.mg && d.mg.call(d.Nca, s);else {var n = {length: k,count: k,ega: d,$ga: h ? [] : {}};C.pda(c,function(c, f) {if (n.d0) return t;var h = !d.mg ? g.s$: g.B9.bind({Uca: n,index: f});d.n1.call(d.EDa, c, f, h)})}}
};
C.path = {join: function() {for (var c = arguments.length,d = "",f = 0; f < c; f++) d = (d + ("" == d ? "": "/") + arguments[f]).replace(/(\/|\\\\)$/, "");return d},Cp: function(c) {return (c = /(\.[^\.\/\?\\]*)(\?.*)?$/.exec(c)) ? c[1] : s},c0a: function(c) {if (c) {var d = c.lastIndexOf(".");if ( - 1 !== d) return c.substring(0, d)}return c},lxa: function(c, d) {var f = c.indexOf("?");0 < f && (c = c.substring(0, f));f = /(\/|\\\\)([^(\/|\\\\)]+)$/g.exec(c.replace(/(\/|\\\\)$/, ""));if (!f) return s;f = f[2];return d && c.substring(c.length - d.length).toLowerCase() == d.toLowerCase() ?f.substring(0, f.length - d.length) : f},dirname: function(c) {return c.replace(/((.*)(\/|\\|\\\\))?(.*?\..*$)?/, "$2")},s_: function(c, d) {d = d || "";var f = c.indexOf("?"),g = "";0 < f && (g = c.substring(f), c = c.substring(0, f));f = c.lastIndexOf(".");return 0 > f ? c + d + g: c.substring(0, f) + d + g},BB: function(c, d, f) {if (0 == d.indexOf(".")) return this.s_(c, d);var g = c.indexOf("?"),h = "";f = f ? this.Cp(c) : "";0 < g && (h = c.substring(g), c = c.substring(0, g));g = c.lastIndexOf("/");return c.substring(0, 0 >= g ? 0 : g + 1) + d + f + h}
};
C.M = {paa: {},KN: {},wta: {},Hv: {},dR: "",dxa: "",fj: {},cI: function() {return window.XMLHttpRequest ? new window.XMLHttpRequest: new ActiveXObject("MSXML2.XMLHTTP")},N$: function(c) {var d = c[0],f = c[1],g = c[2],h = ["", s, s];1 === c.length ? h[1] = d instanceof Array ? d: [d] : 2 === c.length ? "function" == typeof f ? (h[1] = d instanceof Array ? d: [d], h[2] = f) : (h[0] = d || "", h[1] = f instanceof Array ? f: [f]) : 3 === c.length ? (h[0] = d || "", h[1] = f instanceof Array ? f: [f], h[2] = g) : e("arguments error to load js!");return h},nEa: function(c, d, f) {var g = this,h = g.paa,k = g.N$(arguments); - 1 < navigator.userAgent.indexOf("Trident/5") ? g.uaa(k[0], k[1], 0, k[2]) : C.async.map(k[1],function(c, d, f) {c = C.path.join(k[0], c);if (h[c]) return f(s);g.C9(c, t, f)},k[2])},Jfa: function(c, d, f) {var g = this.zta(),h = this.N$(arguments);this.nEa(h[0], h[1],function(c) {c && e(c);g.parentNode.removeChild(g);if (h[2]) h[2]()})},C9: function(c, d, f) {var g = document,h = C.bd("script");h.async = d;h.src = c;this.paa[c] = q;C.qb(h, "load",function() {this.removeEventListener("load", arguments.callee, t);f()},t);C.qb(h, "error",function() {f("Load " + c + " failed!")},t);g.body.appendChild(h)},uaa: function(c, d, f, g) {if (f >= d.length) g && g();else {var h = this;h.C9(C.path.join(c, d[f]), t,function(k) {if (k) return g(k);h.uaa(c, d, f + 1, g)})}},zta: function() {var c = document,d = c.getElementById("cocos2d_loadJsImg");if (!d) {d = C.bd("img");C.xaa && (d.src = C.xaa);c = c.getElementById(C.qf.gj.id);c.style.backgroundColor = "#fff";c.parentNode.appendChild(d);var f = getComputedStyle ? getComputedStyle(c) : c.currentStyle;f || (f = {width: c.width,height: c.height});d.style.left = c.offsetLeft + (parseFloat(f.width) - d.width) / 2 + "px";d.style.top = c.offsetTop + (parseFloat(f.height) - d.height) / 2 + "px";d.style.position = "absolute"}return d},EQ: function(c, d) {if (C.iaa) require("fs").z1a(c,function(c, f) {c ? d(c) : d(s, f.toString())});else {var f = this.cI(),g = "load " + c + " failed!";f.open("GET", c, q);/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) ? (f.setRequestHeader("Accept-Charset", "utf-8"), f.onreadystatechange = function() {4 == f.readyState && 200 == f.status ? d(s, f.responseText) : d(g)}) : (f.overrideMimeType && f.overrideMimeType("text/plain; charset\x3dutf-8"), f.onload = function() {4 == f.readyState && 200 == f.status ? d(s, f.responseText) : d(g)});f.send(s)}},vaa: function(c) {if (C.iaa) return require("fs").A1a(c).toString();var d = this.cI();d.open("GET", c, t);/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) ? d.setRequestHeader("Accept-Charset", "utf-8") : d.overrideMimeType && d.overrideMimeType("text/plain; charset\x3dutf-8");d.send(s);return 4 == !d.readyState || 200 != d.status ? s: d.responseText},Kfa: function(c, d) {this.EQ(c,function(f, g) {try {f ? d(f) : d(s, JSON.parse(g))} catch(h) {e("load json [" + c + "] failed : " + h)}})},u9: function(c) {return /(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(c) != s},wI: function(c, d, f) {var g = q;f !== m ? g = d.g1 == s ? g: d.g1: d !== m && (f = d);var h = new Image;g && "file://" != location.origin && (h.crossOrigin = "Anonymous");C.qb(h, "load",function() {this.removeEventListener("load", arguments.callee, t);this.removeEventListener("error", arguments.callee, t);f && f(s, h)});C.qb(h, "error",function() {this.removeEventListener("error", arguments.callee, t);f && f("load image failed")});h.src = c;return h},Ata: function(c, d, f) {var g = this,h = s; (d = c.type) ? (d = "." + d.toLowerCase(), h = c.src ? c.src: c.name + d) :(h = c, d = C.path.Cp(h));var k = g.fj[h];if (k) return f(s, k);k = g.KN[d.toLowerCase()];if (!k) return C.error("loader for [" + d + "] not exists!"),f();d = g.K0(k.zP ? k.zP() : g.dR, h);k.load(d, h, c,function(c, d) {c ? (C.log(c), g.fj[h] = s, delete g.fj[h], f()) : (g.fj[h] = d, f(s, d))})},K0: function(c, d) {var f = this.wta,g = C.path;if (c !== m && d === m) {d = c;var h = g.Cp(d),h = h ? h.toLowerCase() : "";c = (h = this.KN[h]) ? h.zP ? h.zP() : this.dR: this.dR}d = C.path.join(c || "", d);if (d.match(/[\/(\\\\)]lang[\/(\\\\)]/i)) {if (f[d]) return f[d];g = g.Cp(d) || "";d = f[d] = d.substring(0, d.length - g.length) + "_" + C.Sc.language + g}return d},load: function(c, d, f) {f !== m ? "function" == typeof d && (d = {O3: d}) : d !== m ? "function" == typeof d && (f = d, d = {}) : c !== m ? d = {}: e("arguments error!");d.mg = function(c, d) {c && C.log(c);f && f(d)};c instanceof Array || (c = [c]);d.n1 = this.Ata;d.EDa = this;C.async.map(c, d)},Y$: function(c, d) {var f = this.Hv,g = [],h;for (h in c) {var k = c[h];f[h] = k;g.push(k)}this.load(g, d)},Y_a: function(c, d) {var f = this,g = f.xd(c);g ? f.Y$(g.filenames, d) : f.load(c,function(c) {f.Y$(c[0].filenames, d)})},Zp: function(c, d) {if (c && d) {if ("string" == typeof c) return this.KN[c.trim().toLowerCase()] = d;for (var f = 0,g = c.length; f < g; f++) this.KN["." + c[f].trim().toLowerCase()] = d}},xd: function(c) {return this.fj[c] || this.fj[this.Hv[c]]},rh: function(c) {var d = this.fj,f = this.Hv;delete d[c];delete d[f[c]];delete f[c]},L1a: function() {var c = this.fj,d = this.Hv,f;for (f in c) delete c[f];for (f in d) delete d[f]}
}; (function() {function c() {C.Ka && C.qf.qt && C.Ka.dispatchEvent(C.qf.qt)}function d() {C.Ka && C.qf.pt && C.Ka.dispatchEvent(C.qf.pt)}var f = window,g, h;"undefined" !== typeof document.hidden ? (g = "hidden", h = "visibilitychange") : "undefined" !== typeof document.e0a ? (g = "mozHidden", h = "mozvisibilitychange") :"undefined" !== typeof document.f0a ? (g = "msHidden", h = "msvisibilitychange") :"undefined" !== typeof document.U6a && (g = "webkitHidden", h ="webkitvisibilitychange");g ? C.qb(document, h,function() {document[g] ? d() : c()},t) : (C.qb(f, "blur", d, t), C.qb(f, "focus", c, t));"onpageshow" in window && "onpagehide" in window && (C.qb(f, "pagehide", d, t), C.qb(f, "pageshow", c, t));h = f = s
})();
C.log = C.warn = C.error = C.assert = u();
C.Yca = function(c, d) {for (var f = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"], g = s, h =0; h < f.length; ++h) {try {g = c.getContext(f[h], d)} catch(k) {}if (g) break}return g
};
C.eta = function(c, d) {C.cb = 0;C.la = 1;var f = C.Sc = {};f.Sma = "en";f.gMa = "zh";f.hMa = "fr";f.kMa = "it";f.iMa = "de";f.rMa = "es";f.qMa = "ru";f.mMa = "ko";f.lMa = "ja";f.jMa = "hu";f.pMa = "pt";f.fMa = "ar";f.nMa = "no";f.oMa = "pl";f.Dna = "Windows";f.L6 = "iOS";f.M6 = "OS X";f.Bna = "UNIX";f.Ana = "Linux";f.zna = "Android";f.Cna = "Unknown";f.dka = "wechat";f.aka = "androidbrowser";f.tS = "ie";f.bka = "qqbrowser";f.w4 = "mqqbrowser";f.x4 = "ucbrowser";f.LKa = "360browser";f.MKa = "baiduboxapp";f.v4 = "baidubrowser";f.NKa = "maxthon";f.uS = "opera";f.OKa = "miuibrowser";f.xD = "firefox";f.vS = "safari";f.sS = "chrome";f.cka = "unknown";f.wDa = t;var g = [f.v4, f.uS, f.xD, f.sS, f.vS],h = [f.v4, f.uS, f.xD, f.sS, f.vS, f.x4, f.bka, f.w4, f.tS],k = window,n = k.navigator,p = document.documentElement,r = n.userAgent.toLowerCase();f.Xr = -1 != r.indexOf("mobile") || -1 != r.indexOf("android");var v = n.language,v = (v = v ? v: n.browserLanguage) ? v.split("-")[0] : f.Sma;f.language = v;var v = f.cka,y = r.match(/micromessenger|qqbrowser|mqqbrowser|ucbrowser|360browser|baiduboxapp|baidubrowser|maxthon|trident|opera|miuibrowser|firefox/i) || r.match(/chrome|safari/i);y && 0 < y.length && (v = y[0].toLowerCase(), "micromessenger" == v ? v = f.dka: "safari" === v && r.match(/android.*applewebkit/) ? v = f.aka: "trident" == v && (v = f.tS));f.tu = v;f.Ova = -1 < h.indexOf(f.tu);h = parseInt(c[d.bR]);v = C.la;y = C.bd("Canvas");C.SG = q;g = -1 == g.indexOf(f.tu);if (1 === h || 0 === h && (f.Xr || g)) v = C.cb;if (v == C.la && (!k.WebGLRenderingContext || !C.Yca(y, {stencil: q,preserveDrawingBuffer: q}))) 0 == h ? v = C.cb: C.SG = t;if (v == C.cb) try {y.getContext("2d")} catch(z) {C.SG = t}C.L = v;try {f.jO = !!new(k.AudioContext || k.webkitAudioContext || k.mozAudioContext)} catch(D) {f.jO = t}try {var E = f.localStorage = k.localStorage;E.setItem("storage", "");E.removeItem("storage");E = s} catch(F) { ("SECURITY_ERR" === F.name || "QuotaExceededError" === F.name) && C.warn("Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option"),f.localStorage = u()}E = f.uH = {canvas: q};C.L == C.la && (E.opengl = q);p.ontouchstart !== m || n.msPointerEnabled ? E.touches = q: p.onmouseup !== m && (E.mouse = q);p.onkeyup !== m && (E.keyboard = q);if (k.DeviceMotionEvent || k.DeviceOrientationEvent) E.accelerometer = q;k = r.match(/(iPad|iPhone|iPod)/i) ? q: t;r = r.match(/android/i) || n.platform.match(/android/i) ? q: t;p = f.Cna; - 1 != n.appVersion.indexOf("Win") ? p = f.Dna: k ? p = f.L6: -1 != n.appVersion.indexOf("Mac") ? p = f.M6: -1 != n.appVersion.indexOf("X11") ? p = f.Bna: -1 != n.appVersion.indexOf("Linux") ? p = f.Ana: r && (p = f.zna);f.Q1 = p;f.DSa = u();f.RRa = u();f.C2a = u();f.PRa = function() {var c;c = "" + ("isMobile : " + this.Xr + "\r\n");c += "language : " + this.language + "\r\n";c += "browserType : " + this.tu + "\r\n";c += "capabilities : " + JSON.stringify(this.uH) + "\r\n";c += "os : " + this.Q1 + "\r\n";C.log(c)}
};
源码
需要源码请关注添加好友哦^ ^
转载:欢迎来到本站,转载请注明文章出处
https://ormcc.com/