This commit is contained in:
Aaron Fischer 2015-09-13 10:40:26 +02:00
parent 54a3333ff3
commit a8c1ebbfe3
7 changed files with 79 additions and 11 deletions

View file

@ -4,7 +4,8 @@ compile:
mkdir -p out mkdir -p out
babel src/*.js -o out/js13kgames-2015.js babel src/*.js -o out/js13kgames-2015.js
uglifyjs --compress --mangle -- out/js13kgames-2015.js > out/js13kgames-2015.min.js uglifyjs --compress --mangle -- out/js13kgames-2015.js > out/js13kgames-2015.min.js
cp vendor/minified.js out/minified.min.js # ca. 8kb space wasted ... cp vendor/minified-custom.js out/minified.min.js # ca. 8kb space wasted ...
cp vendor/asteroid-icon.png out/asteroid.png
cp -f src/*.{html,css} out/ cp -f src/*.{html,css} out/
rm out/js13kgames-2015.js rm out/js13kgames-2015.js

View file

@ -4,8 +4,10 @@
<title>js13kGames 2015 -- Aaron Fischer</title> <title>js13kGames 2015 -- Aaron Fischer</title>
<script src="minified.min.js"></script> <script src="minified.min.js"></script>
<script src="js13kgames-2015.min.js"></script> <script src="js13kgames-2015.min.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css">
</head> </head>
<body> <body>
<img src="asteroid.png" width="300px">
<nav> <nav>
<ul> <ul>
<li>Dust: <strong class="res-dust">0</strong></li> <li>Dust: <strong class="res-dust">0</strong></li>
@ -17,11 +19,17 @@
</nav> </nav>
<div id="startgame"> <div id="startgame">
<button>Start the adventure now</button> Oh snap! The <strong>reverser</strong> is broken! Without this expensive part, tthe ship
can't do any hyperjumps any more. We are stuck in the middle of nowhere,
just a vast amount of black space. Luckily, there is an old space station
near by, so we can buy the part for some money.<br><br>
But before that, some resources need to be harvest...
<br><br><br>
<button>Poke your probe!</button>
</div> </div>
<div id="endgame"> <div id="endgame">
You've made it! You've made it!<br>
You can leave this rotten ugly place now. You can leave this rotten ugly place now.
</div> </div>

View file

@ -22,13 +22,13 @@ class Engine {
update() { update() {
// Endgame? // Endgame?
if (!this.game_running) { if (!this.game_running) {
$('#ship, #asteroid, #station, #startgame').hide(); $('#ship, #asteroid, #station, #startgame, nav').hide();
$('#endgame').show(); $('#endgame').show();
return; return;
} }
if (this.init_sequence_run) { if (this.init_sequence_run) {
$('#ship, #asteroid, #station, #endgame').hide(); $('#ship, #asteroid, #station, #endgame, nav').hide();
$('#startgame').show(); $('#startgame').show();
return; return;
} }
@ -117,7 +117,7 @@ class Ship {
carbon: 0, carbon: 0,
metal: 0 metal: 0
}; };
this.cbtc = 999999999; //450; this.cbtc = 430;
} }
mount(tool) { mount(tool) {
@ -333,7 +333,7 @@ $(() => {
$('#startgame button').onClick((e) => { $('#startgame button').onClick((e) => {
$('#startgame').hide(); $('#startgame').hide();
$('#ship').show(); $('#ship, nav').show();
engine.init_sequence_run = false; engine.init_sequence_run = false;
engine.update(); engine.update();

View file

@ -1,4 +1,40 @@
* { body {
margin: 0; margin: auto;
padding: 0; width: 400px;
background-color: black;
color: white;
}
nav {
color: #aaa;
position: relative;
top: -40px;
}
nav strong {
color: #fbb;
}
input {
width: 50px;
}
a {
color: #bbf;
}
a:hover {
background-color: #333;
}
img {
image-rendering: optimizeSpeed;
image-rendering: -moz-crisp-edges;
image-rendering: -webkit-optimize-contrast;
image-rendering: pixelated;
image-rendering: optimize-contrast;
margin-left: 50px;
}
#startgame, #endgame {
font-style: italic;
color: #ffb;
} }

BIN
vendor/asteroid-icon.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

24
vendor/minified-custom.js vendored Normal file
View file

@ -0,0 +1,24 @@
/^u/.test(typeof define)&&function(z){var A=this.require=function(n){return z[n]};this.define=function(n,x){z[n]=z[n]||x(A)}}({});
define("minified",function(){function z(a){return a.substr(0,3)}function A(a){return a!=k?""+a:""}function n(a){return"string"==typeof a}function x(a){return!!a&&"object"==typeof a}function B(a){return a&&a.nodeType}function P(a){return"number"==typeof a}function Q(a){return!0===a||!1===a}function y(a){return a}function r(a,c,b){return A(a).replace(c,b!=k?b:"")}function G(a){return r(a,/^\s+|\s+$/g)}function p(a,c,b){for(var d in a)a.hasOwnProperty(d)&&c.call(b||a,d,a[d]);return a}function m(a,c,
b){if(a)for(var d=0;d<a.length;d++)c.call(b||a,a[d],d);return a}function ia(a,c){var b=[],d=h(c)?c:function(a){return c!=a};m(a,function(c,f){d.call(a,c,f)&&b.push(c)});return b}function w(a,c,b){var d=[];a(c,function(a,f){u(a=b.call(c,a,f))?m(a,function(a){d.push(a)}):a!=k&&d.push(a)});return d}function v(a,c){var b=[];m(a,function(d,e){b.push(c.call(a,d,e))});return b}function C(a,c){var b=c||{},d;for(d in a)b[d]=a[d];return b}function R(a,c){for(var b=c,d=0;d<a.length;d++)b=C(a[d],b);return b}
function S(a,c,b){return c==k?b:0>c?Math.max(a.length+c,0):Math.min(a.length,c)}function T(a){var c=[];if(a)for(var b=S(a,void 0,a.length),d=S(a,1,0);d<b;d++)c.push(a[d]);return c}function U(a,c){for(var b=0;b<a.length;b++)if(a[b]==c)return!0;return!1}function D(a,c,b){if(h(a))return a.apply(b&&c,v(b||c,y))}function ja(a){v(a,function(a){return D(a,void 0,void 0)})}function ka(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}function V(a){return r(a,/[\x00-\x1f'"\u2028\u2029]/g,ka)}
function L(a,c){return a.split(c)}function W(a,c){function b(a,b){var d=[];e.call(b||a,a,function(a,c){u(a)?m(a,function(a,b){c.call(a,a,b)}):p(a,function(a,b){c.call(b,a,b)})},c||y,function(){D(d.push,d,arguments)},H);return d.join("")}if(I[a])return I[a];var d="with(_.isObject(obj)?obj:{}){"+v(L(a,/{{|}}}?/g),function(a,c){var b,d=G(a),e=r(d,/^{/),d=d==e?"esc(":"";if(c%2)return(b=/^each\b(\s+([\w_]+(\s*,\s*[\w_]+)?)\s*:)?(.*)/.exec(e))?"each("+(G(b[4])?b[4]:"this")+", function("+b[2]+"){":(b=/^if\b(.*)/.exec(e))?
"if("+b[1]+"){":(b=/^else\b\s*(if\b(.*))?/.exec(e))?"}else "+(b[1]?"if("+b[2]+")":"")+"{":(b=/^\/(if)?/.exec(e))?b[1]?"}\n":"});\n":(b=/^(var\s.*)/.exec(e))?b[1]+";":(b=/^#(.*)/.exec(e))?b[1]:(b=/(.*)::\s*(.*)/.exec(e))?"print("+d+'_.formatValue("'+V(b[2])+'",'+(G(b[1])?b[1]:"this")+(d&&")")+"));\n":"print("+d+(G(e)?e:"this")+(d&&")")+");\n";if(a)return'print("'+V(a)+'");\n'}).join("")+"}",e=new Function("obj","each","esc","print","_",d);99<X.push(b)&&delete I[X.shift()];return I[a]=b}function ma(a){return r(a,
/[<>'"&]/g,function(a){return"&#"+a.charCodeAt(0)+";"})}function Y(a,c){return W(a,ma)(c)}function Z(a){return function(c,b,d){return a(this,c,b,d)}}function aa(a){return function(c,b,d){return new E(a(c,b,d))}}function h(a){return"function"==typeof a&&!a.item}function u(a){return a&&a.length!=k&&!n(a)&&!B(a)&&!h(a)&&a!==ba}function M(a){return a.Nia=a.Nia||++ca}function na(a,c){var b=[],d={},e;l(a,function(a){l(c(a),function(a){d[e=M(a)]||(b.push(a),d[e]=!0)})});return b}function da(a){J?J.push(a):
setTimeout(a,0)}function ea(a,c,b){return F(a,c,b)[0]}function fa(a,c,b){a=t(document.createElement(a));return u(c)||c!=k&&!x(c)?a.add(c):a.set(c).add(b)}function ga(a){return w(l,a,function(a){if(u(a))return ga(a);B(a)&&(a=a.cloneNode(!0),a.removeAttribute&&a.removeAttribute("id"));return a})}function t(a,c,b){return h(a)?da(a):new E(F(a,c,b))}function F(a,c,b){function d(a){return u(a)?w(l,a,d):a}function e(a){return ia(w(l,a,d),function(a){for(;a=a.parentNode;)if(a==c[0]||b)return a==c[0]})}return c?
1!=(c=F(c)).length?na(c,function(c){return F(a,c,b)}):n(a)?1!=B(c[0])?[]:b?e(c[0].querySelectorAll(a)):c[0].querySelectorAll(a):e(a):n(a)?document.querySelectorAll(a):w(l,a,d)}function oa(a,c){function b(a,b){var c=RegExp("(^|\\s+)"+a+"(?=$|\\s)","i");return function(d){return a?c.test(d[b]):!0}}var d={},e=d;if(h(a))return a;if(P(a))return function(b,c){return c==a};if(!a||"*"==a||n(a)&&(e=/^([\w-]*)\.?([\w-]*)$/.exec(a))){var f=b(e[1],"tagName"),g=b(e[2],"className");return function(a){return 1==
B(a)&&f(a)&&g(a)}}if(c)return function(b){return t(a,c).find(b)!=k};t(a).each(function(a){d[M(a)]=!0});return function(a){return d[M(a)]}}function l(a,c){u(a)?m(a,c):a!=k&&c(a,0);return a}function pa(){this.state=null;this.values=[];this.parent=null}function K(){var a=[],c=arguments,b=c.length,d=0,e=0,f=new pa;f.errHandled=function(){e++;f.parent&&f.parent.errHandled()};var g=f.fire=function(b,c){null==f.state&&null!=b&&(f.state=!!b,f.values=u(c)?c:[c],setTimeout(function(){m(a,function(a){a()})},
0));return f};m(c,function la(a,c){try{a.then?a.then(function(a){(x(a)||h(a))&&h(a.then)?la(a,c):(f.values[c]=v(arguments,y),++d==b&&g(!0,2>b?f.values[c]:f.values))},function(a){f.values[c]=v(arguments,y);g(!1,2>b?f.values[c]:[f.values[c][0],f.values,c])}):a(function(){g(!0,v(arguments,y))},function(){g(!1,v(arguments,y))})}catch(e){g(!1,[e,f.values,c])}});f.stop=function(){m(c,function(a){a.stop&&a.stop()});return f.stop0&&D(f.stop0)};var q=f.then=function(c,b){function d(){try{var a=f.state?c:b;
h(a)?function qa(a){try{var c,b=0;if((x(a)||h(a))&&h(c=a.then)){if(a===g)throw new TypeError;c.call(a,function(a){b++||qa(a)},function(a){b++||g.fire(!1,[a])});g.stop0=a.stop}else g.fire(!0,[a])}catch(d){if(!b++&&(g.fire(!1,[d]),!e))throw d;}}(D(a,ha,f.values)):g.fire(f.state,f.values)}catch(q){if(g.fire(!1,[q]),!e)throw q;}}var g=K();h(b)&&f.errHandled();g.stop0=f.stop;g.parent=f;null!=f.state?setTimeout(d,0):a.push(d);return g};f.always=function(a){return q(a,a)};f.error=function(a){return q(0,
a)};return f}function E(a,c){var b=0;if(a)for(var d=0,e=a.length;d<e;d++){var f=a[d];if(c&&u(f))for(var g=0,q=f.length;g<q;g++)this[b++]=f[g];else this[b++]=f}else this[b++]=c;this.length=b;this._=!0}function H(){return new E(arguments,!0)}var ba=window,N={},O={},ca=1,J=/^[ic]/.test(document.readyState)?k:[],k=null,ha;v(L("January,February,March,April,May,June,July,August,September,October,November,December",/,/g),z);v(L("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",/,/g),z);var I={},
X=[];C({each:Z(m),contains:Z(U),c:0,remove:function(){l(this,function(a){a.parentNode.removeChild(a)})},text:function(){return w(l,this,function(a){return a.textContent}).join("")},select:function(a,c){return t(a,this,c)},get:function(a,c){var b=this,d=b[0];if(d){if(n(a)){var e=/^(\W*)(.*)/.exec(r(a,/^%/,"@data-")),f=e[1],d=O[f]?O[f](this,e[2]):"$"==a?b.get("className"):"$$"==a?b.get("@style"):"$$slide"==a?b.get("$height"):"$$fade"==a||"$$show"==a?"hidden"==b.get("$visibility")||"none"==b.get("$display")?
0:"$$fade"==a?isNaN(b.get("$opacity",!0))?1:b.get("$opacity",!0):1:"$"==f?ba.getComputedStyle(d,k).getPropertyValue(r(e[2],/[A-Z]/g,function(a){return"-"+a.toLowerCase()})):"@"==f?d.getAttribute(e[2]):d[e[2]];return c?parseFloat(r(d,/^[^\d-]+/)):d}var g={};(u(a)?l:p)(a,function(a){g[a]=b.get(a,c)});return g}},set:function(a,c){var b=this;if(c!==ha){var d=/^(\W*)(.*)/.exec(r(r(a,/^\$float$/,"cssFloat"),/^%/,"@data-")),e=d[1];if(N[e])N[e](this,d[2],c);else"$$fade"==a?this.set({$visibility:c?"visible":
"hidden",$opacity:c}):"$$slide"==a?b.set({$visibility:c?"visible":"hidden",$overflow:"hidden",$height:/px/.test(c)?c:function(a,b,d){a=t(d);d={$position:"absolute",$visibility:"hidden",$display:"block",$height:k};b=a.get(d);d=a.set(d).get("clientHeight");a.set(b);return d*c+"px"}}):"$$show"==a?c?b.set({$visibility:c?"visible":"hidden",$display:""}).set({$display:function(a){return"none"==a?"block":a}}):b.set({$display:"none"}):"$$"==a?b.set("@style",c):l(this,function(b,g){var q=h(c)?c(t(b).get(a),
g,b):c;"$"==e?d[2]?b.style[d[2]]=q:l(q&&q.split(/\s+/),function(a){var c=r(a,/^[+-]/);/^\+/.test(a)?b.classList.add(c):/^-/.test(a)?b.classList.remove(c):b.classList.toggle(c)}):"$$scrollX"==a?b.scroll(q,t(b).get("$$scrollY")):"$$scrollY"==a?b.scroll(t(b).get("$$scrollX"),q):"@"==e?q==k?b.removeAttribute(d[2]):b.setAttribute(d[2],q):b[d[2]]=q})}else n(a)||h(a)?b.set("$",a):p(a,function(a,c){b.set(a,c)});return b},show:function(){return this.set("$$show",1)},hide:function(){return this.set("$$show",
0)},add:function(a,c){return this.each(function(b,d){function e(a){u(a)?l(a,e):h(a)?e(a(b,d)):a!=k&&(a=B(a)?a:document.createTextNode(a),f?f.parentNode.insertBefore(a,f.nextSibling):c?c(a,b,b.parentNode):b.appendChild(a),f=a)}var f;e(d&&!h(a)?ga(a):a)})},fill:function(a){return this.each(function(a){t(a.childNodes).remove()}).add(a)},offset:function(){for(var a=this[0],c={x:0,y:0};a;)c.x+=a.offsetLeft,c.y+=a.offsetTop,a=a.offsetParent;return c},on:function(a,c,b,d,e){return h(c)?this.on(k,a,c,b,d):
n(d)?this.on(a,c,b,k,d):this.each(function(f,g){l(a?F(a,f):f,function(a){l(A(c).split(/\s/),function(c){function f(c,k,l){var m=!e;l=e?l:a;if(e)for(var p=oa(e,a);l&&l!=a&&!(m=p(l));)l=l.parentNode;return!m||h!=c||b.apply(t(l),d||[k,g])&&"?"==n||"|"==n}function k(a){f(h,a,a.target)||(a.preventDefault(),a.stopPropagation())}var h=r(c,/[?|]/g),n=r(c,/[^?|]/g),m=("blur"==h||"focus"==h)&&!!e,p=ca++;a.addEventListener(h,k,m);a.M||(a.M={});a.M[p]=f;b.M=w(l,[b.M,function(){a.removeEventListener(h,k,m);delete a.M[p]}],
y)})})})},onClick:function(a,c,b,d){return h(c)?this.on(a,"click",c,b,d):this.onClick(k,a,c,b)},f:0,ht:function(a,c){var b=2<arguments.length?R(T(arguments)):c;return this.set("innerHTML",h(a)?a(b):/{{/.test(a)?Y(a,b):/^#\S+$/.test(a)?Y(ea(a).text,b):a)}},E.prototype);C({request:function(a,c,b,d){d=d||{};var e,f=0,g=K(),h=b&&b.constructor==d.constructor;try{g.xhr=e=new XMLHttpRequest,g.stop0=function(){e.abort()},h&&(b=w(p,b,function(a,b){return w(l,b,function(b){return encodeURIComponent(a)+(b!=
k?"="+encodeURIComponent(b):"")})}).join("&")),b==k||/post/i.test(a)||(c+="?"+b,b=k),e.open(a,c,!0,d.user,d.pass),h&&/post/i.test(a)&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),p(d.headers,function(a,b){e.setRequestHeader(a,b)}),p(d.xhr,function(a,b){e[a]=b}),e.onreadystatechange=function(){4!=e.readyState||f++||(200<=e.status&&300>e.status?g.fire(!0,[e.responseText,e]):g.fire(!1,[e.status,e.responseText,e]))},e.send(b)}catch(m){f||g.fire(!1,[0,k,A(m)])}return g},toJSON:JSON.stringify,
parseJSON:JSON.parse,ready:da,b:null,wait:function(a,c){var b=K(),d=setTimeout(function(){b.fire(!0,c)},a);b.stop0=function(){b.fire(!1);clearTimeout(d)};return b}},t);C({each:m,toObject:function(a,c){var b={};m(a,function(a){b[a]=c});return b},contains:U,keys:aa(function(a){var c=[];p(a,function(a){c.push(a)});return c}),values:aa(function(a,c){var b=[];c?m(c,function(c){b.push(a[c])}):p(a,function(a,c){b.push(c)});return b}),copyObj:C,extend:function(a){return R(T(arguments),a)},eachObj:p,mapObj:function(a,
c,b){var d={};p(a,function(e,f){d[e]=c.call(b||a,e,f)});return d},filterObj:function(a,c,b){var d={};p(a,function(e,f){c.call(b||a,e,f)&&(d[e]=f)});return d},isList:u,isFunction:h,isObject:x,isNumber:P,isBool:Q,isDate:function(a){return x(a)&&!!a.getDay},isValue:function(a){var c=typeof a;return"object"==c?!(!a||!a.getDay):"string"==c||"number"==c||Q(a)},isString:n,toString:A,template:W,a:0,promise:K},H);document.addEventListener("DOMContentLoaded",function(){ja(J);J=k},!1);return{HTML:function(){var a=
fa("div");return H(D(a.ht,a,arguments)[0].childNodes)},_:H,$:t,$$:ea,EE:fa,M:E,getter:O,setter:N}});

1
vendor/minified.js vendored

File diff suppressed because one or more lines are too long