Skip to content
Browse files

Initial Commit

  • Loading branch information...
1 parent 4fa7f07 commit 60ed01697aa8f31256a34c41ab683df27bdff170 @crteal crteal committed Oct 28, 2012
Showing with 481 additions and 64 deletions.
  1. +1 −64 README.md
  2. +19 −0 index.html
  3. +75 −0 resources/grass.svg
  4. +98 −0 resources/octocat.svg
  5. +40 −0 script/game.js
  6. +33 −0 script/keyboard.js
  7. +77 −0 script/map.js
  8. +54 −0 script/player.js
  9. +44 −0 script/utils.js
  10. +40 −0 style/style.css
View
65 README.md
@@ -1,64 +1 @@
-Here at GitHub, we're no strangers to hosting or sponsoring hackathons. With the growing number of games and game development resources on GitHub, we thought it was about time to throw our very own game jam!
-
-## The Challenge
-
-You have the entire month of November to create a **web-based** game *loosely* built around one or more of the following themes:
-
-* forking (or forks)
-* branching (or branches)
-* cloning (or clones)
-* pushing
-* pulling
-
-What do we mean by **loosely** based on these concepts? We literally mean, *loosely* based. Some examples might be a FPS where you throw forks at water balloons, an educational game about DNA cloning, or perhaps a platformer where you push and pull objects.
-
-Your game. Your rules. You can participate as an individual or as a team. You're encouraged to use open source libraries, frameworks, graphics, and sounds.
-
-## Prizes
-
-We have 5 shiny new iPads with Retina displays (64GB wifi models) to give to our winners (or Apple Store Credit equivalent). Runners up will receive GitHub swag of their choice ($100 credit for the [GitHub Shop](http://shop.github.com/)). If you have a team submission, we'll give you Apple Store credit equal to the value of the iPad. You can split it with your teammates as appropriate.
-
-All of the winners and runners up will be showcased on our blog.
-
-<img src="http://i.imgur.com/lxZrD.png" style="border:0;">
-
-### Everyone's a winner!
-
-All participants will receive a limited edition [Coderwall](http://www.coderwall.com) badge as shown above. Winners and runners up will also get their own special version of it.
-
-## Judging
-
-We have a number of awesome judges who graciously volunteered to take a look at all the entries!
-
-* [David Czarnecki](http://twitter.com/CzarneckiD), Lead Engineer at Agora Games
-* [Eric Preisz](https://twitter.com/epreisz), CEO of GarageGames
-* [Matt Hackett](https://twitter.com/#!/richtaur), Co-founder of Lost Decade Games
-* [Lee Reilly](http://twitter.com/leereilly), Gamer Dad and Software Developer at GitHub
-* [Romana Ramzan](https://twitter.com/Manak/), Denki's Player Champion. PhD Researcher. Organiser of Scottish Game Jam.
-
-## Rules
-
-* To qualify for entry as an **individual** you must fork the [github/game-off-2012](https://github.com/github/game-off-2012) repository to your individual account
-* To qualify for entry as a **team** you must fork the [github/game-off-2012](https://github.com/github/game-off-2012) to a [free organization account](https://github.com/settings/organizations)
-* All entries must be web-based i.e. playable in a browser. HTML5, WebGL, Unity, Torque 3D, Node JS, Flash is all possible - just be sure the source is made available on your fork.
-* You must be over the age of 13
-
-## Instructions
-
-* If you don't already have a GitHub account, [sign up now](https://github.com/signup/free) - it's free!
-* Fork the [github/game-off-2012](https://github.com/github/game-off-2012) repository to your individual account (or to a free organization account)
-* Be sure to follow @github on Twitter for updates
-* Make sure your code is pushed to the master branch of before Dec 1st!
-* Make sure you have a README file with a brief description, what open source projects (if any) you used, and a screenshot.
-* Your repo should have a brief description and a URL where the game is playable entered into the fields shown below (this will make our judging process easier):
-
-![](https://img.skitch.com/20121010-x2ecpu95fi91us6hbfehg2dgit.png)
-
-Winners will be announced before Christmas :santa:
-
-# Comments / Questions / Help
-
-* New to Git, GitHub, and/or version control? Check out our [help documentation](https://help.github.com/) to get started!
-* Questions about Git/GitHub? Please email support@github.com and be sure to include 'GitHub Game Off' in the subject.
-* Questions specific to the GitHub Game Off? Please [create an issue](https://github.com/github/game-off-2012/issues/new). That will be the offical FAQ.
-* The official Twitter hashtag is [#ggo12](https://twitter.com/search/realtime?q=%23ggo12).
+# Don't Go Home With Your Game Off
View
19 index.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>Github Game Off</title>
+ <link href="style/style.css" rel="stylesheet" />
+ </head>
+ <body>
+ <div class="metrics">
+ <div class="fps"></div>
+ </div>
+ <div class="game"></div>
+ <script src="script/utils.js"></script>
+ <script src="script/keyboard.js"></script>
+ <script src="script/map.js"></script>
+ <script src="script/player.js"></script>
+ <script src="script/game.js"></script>
+ </body>
+</html>
View
75 resources/grass.svg
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="64"
+ id="svg2987"
+ version="1.1"
+ inkscape:version="0.48.2 r9819"
+ sodipodi:docname="grass.svg">
+ <title
+ id="title3765">Grass</title>
+ <defs
+ id="defs2989">
+ <linearGradient
+ id="linearGradient5295"
+ osb:paint="solid">
+ <stop
+ style="stop-color:#35eb0f;stop-opacity:1;"
+ offset="0"
+ id="stop5297" />
+ </linearGradient>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8"
+ inkscape:cx="-29.357143"
+ inkscape:cy="44.415613"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1440"
+ inkscape:window-height="837"
+ inkscape:window-x="-4"
+ inkscape:window-y="-4"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata2992">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Grass</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-988.36218)">
+ <rect
+ style="fill:#35eb0f;fill-opacity:1;stroke:#35eb0f;stroke-width:0.98299885;stroke-opacity:1"
+ id="rect2995"
+ width="64"
+ height="64"
+ x="0.49149942"
+ y="988.8537" />
+ </g>
+</svg>
View
98 resources/octocat.svg
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ viewBox="-0.2 -1 379 334"
+ id="svg3965"
+ version="1.1"
+ inkscape:version="0.48.2 r9819"
+ width="100%"
+ height="100%"
+ sodipodi:docname="octocat_g.svg">
+ <metadata
+ id="metadata3987">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs3985" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="640"
+ inkscape:window-height="480"
+ id="namedview3983"
+ showgrid="false"
+ inkscape:zoom="0.70658683"
+ inkscape:cx="189.5"
+ inkscape:cy="167"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg3965" />
+ <path
+ id="cat"
+ d="m 378.18,182.36237 0.28,-1.389 c -31.162,-6.231 -63.141,-6.294 -82.487,-5.49 3.178,-11.451 4.134,-24.627 4.134,-39.32 0,-21.073 -7.917,-37.930997 -20.77,-50.758997 2.246,-7.25 5.246,-23.351 -2.996,-43.963 0,0 -14.541,-4.617 -47.431,17.396 -12.884,-3.22 -26.596,-4.81 -40.328,-4.81 -15.109,0 -30.376,1.924 -44.615,5.83 -33.94,-23.154 -48.923,-18.411 -48.923,-18.411 -9.78,24.457 -3.733,42.566 -1.896,47.063 -11.495,12.405997 -18.513,28.242997 -18.513,47.658997 0,14.658 1.669,27.808 5.745,39.237 -19.511,-0.71 -50.323,-0.437 -80.373,5.572 l 0.276,1.389 c 30.231,-6.046 61.237,-6.256 80.629,-5.522 0.898,2.366 1.899,4.661 3.021,6.879 -19.177,0.618 -51.922,3.062 -83.303,11.915 l 0.387,1.36 c 31.629,-8.918 64.658,-11.301 83.649,-11.882 11.458,21.358 34.048,35.152 74.236,39.484 -5.704,3.833 -11.523,10.349 -13.881,21.374 -7.773,3.718 -32.379,12.793 -47.142,-12.599 0,0 -8.264,-15.109 -24.082,-16.292 0,0 -15.344,-0.235 -1.059,9.562 0,0 10.267,4.838 17.351,23.019 0,0 9.241,31.01 53.835,21.061 v 32.032 c 0,0 -0.943,11.33 -11.33,15.105 0,0 -6.137,4.249 0.475,6.606 0,0 28.792,2.361 28.792,-21.238 v -34.929 c 0,0 -1.142,-13.852 5.663,-18.667 v 57.371 c 0,0 -0.47,13.688 -7.551,18.881 0,0 -4.723,8.494 5.663,6.137 0,0 19.824,-2.832 20.769,-25.961 l 0.449,-58.06 h 4.765 l 0.453,58.06 c 0.943,23.129 20.768,25.961 20.768,25.961 10.383,2.357 5.663,-6.137 5.663,-6.137 -7.08,-5.193 -7.551,-18.881 -7.551,-18.881 v -56.876 c 6.801,5.296 5.663,18.171 5.663,18.171 v 34.929 c 0,23.6 28.793,21.238 28.793,21.238 6.606,-2.357 0.474,-6.606 0.474,-6.606 -10.386,-3.775 -11.33,-15.105 -11.33,-15.105 v -45.786 c 0,-17.854 -7.518,-27.309 -14.87,-32.3 42.859,-4.25 63.426,-18.089 72.903,-39.591 18.773,0.516 52.557,2.803 84.873,11.919 l 0.384,-1.36 c -32.131,-9.063 -65.692,-11.408 -84.655,-11.96 0.898,-2.172 1.682,-4.431 2.378,-6.755 19.25,-0.8 51.38,-0.79 82.66,5.46 z"
+ inkscape:connector-curvature="0" />
+ <path
+ id="face"
+ d="m 258.19,135.17437 c 9.231,8.363 14.631,18.462 14.631,29.343 0,50.804 -37.872,52.181 -84.585,52.181 -46.721,0 -84.589,-7.035 -84.589,-52.181 0,-10.809 5.324,-20.845 14.441,-29.174 15.208,-13.881 40.946,-6.531 70.147,-6.531 29.07,-0.004 54.72,-7.429 69.95,6.357 z"
+ inkscape:connector-curvature="0"
+ style="fill:#f4cbb2" />
+ <path
+ id="eyes"
+ d="m 160.1,167.10237 c 0,13.994 -7.88,25.336 -17.6,25.336 -9.72,0 -17.6,-11.342 -17.6,-25.336 0,-13.992 7.88,-25.33 17.6,-25.33 9.72,0.01 17.6,11.34 17.6,25.33 z m 94.43,0 c 0,13.994 -7.88,25.336 -17.6,25.336 -9.72,0 -17.6,-11.342 -17.6,-25.336 0,-13.992 7.88,-25.33 17.6,-25.33 9.72,0.01 17.6,11.34 17.6,25.33 z"
+ inkscape:connector-curvature="0"
+ style="fill:#ffffff" />
+ <g
+ id="g3976"
+ transform="translate(0,41.042373)"
+ style="fill:#ad5c51">
+ <path
+ id="pupils"
+ d="m 154.46,126.38 c 0,9.328 -5.26,16.887 -11.734,16.887 -6.474,0 -11.733,-7.559 -11.733,-16.887 0,-9.331 5.255,-16.894 11.733,-16.894 6.47,0 11.73,7.56 11.73,16.89 z m 94.42,0 c 0,9.328 -5.26,16.887 -11.734,16.887 -6.474,0 -11.733,-7.559 -11.733,-16.887 0,-9.331 5.255,-16.894 11.733,-16.894 6.47,0 11.73,7.56 11.73,16.89 z"
+ inkscape:connector-curvature="0" />
+ <circle
+ id="nose"
+ cx="188.5"
+ cy="148.56"
+ r="4.401"
+ d="m 192.901,148.56 c 0,2.4306 -1.97039,4.401 -4.401,4.401 -2.43061,0 -4.401,-1.9704 -4.401,-4.401 0,-2.43061 1.97039,-4.401 4.401,-4.401 2.43061,0 4.401,1.97039 4.401,4.401 z"
+ sodipodi:cx="188.5"
+ sodipodi:cy="148.56"
+ sodipodi:rx="4.401"
+ sodipodi:ry="4.401" />
+ <path
+ id="mouth"
+ d="m 178.23,159.69 c -0.26,-0.738 0.128,-1.545 0.861,-1.805 0.737,-0.26 1.546,0.128 1.805,0.861 1.134,3.198 4.167,5.346 7.551,5.346 3.384,0 6.417,-2.147 7.551,-5.346 0.26,-0.738 1.067,-1.121 1.805,-0.861 0.738,0.26 1.121,1.067 0.862,1.805 -1.529,4.324 -5.639,7.229 -10.218,7.229 -4.579,0 -8.68,-2.89 -10.21,-7.22 z"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ id="octo"
+ d="m 80.641,220.86237 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z m 8.5,4.72 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z m 5.193,6.14 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z m 4.72,7.08 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z m 5.188,6.61 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z m 7.09,5.66 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z m 9.91,3.78 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z m 9.87,0 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z m 10.01,-1.64 c 0,1.174 -1.376,2.122 -3.07,2.122 -1.693,0 -3.07,-0.948 -3.07,-2.122 0,-1.175 1.377,-2.127 3.07,-2.127 1.694,0 3.07,0.95 3.07,2.13 z"
+ inkscape:connector-curvature="0"
+ style="fill:#c3e4d8" />
+ <path
+ id="drop"
+ d="m 69.369,227.16237 -3.066,10.683 c 0,0 -0.8,3.861 2.84,4.546 3.8,-0.074 3.486,-3.627 3.223,-4.781 z"
+ inkscape:connector-curvature="0"
+ style="fill:#9cdaf1" />
+</svg>
View
40 script/game.js
@@ -0,0 +1,40 @@
+(function() {
+ var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
+ window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
+ window.requestAnimationFrame = requestAnimationFrame;
+})();
+
+(function () {
+
+ "use strict";
+
+ function game(e) {
+ var st, lt, t = 0;
+ st = lt = now();
+ requestAnimationFrame(function step(ft) {
+ var dt = ft - lt;
+ lt = ft;
+ e.forEach(function (i) {
+ i.update(dt, t);
+ });
+ e.forEach(function (i) {
+ i.draw();
+ });
+ requestAnimationFrame(step);
+ });
+ return st;
+ }
+
+ var st,
+ f = 0,
+ el = elem(".fps"),
+ m = map(8, ["", "block", "monster"], [7.5, 2, 0.5], function (t, r, c) {
+ return (initPosition[1] == r && initPosition[0] == c) ? "" : t;
+ });
+
+ drawMap(elem(".game"), m);
+
+ tile(initPosition[0], initPosition[1]).innerHTML = '<div class="player"></div>';
+
+ st = game([player]);
+} ());
View
33 script/keyboard.js
@@ -0,0 +1,33 @@
+var Keyboard = (function (el) {
+
+ var k = {};
+
+ function listen(el, e, l) {
+ return el.addEventListener(e, l, false);
+ }
+
+ function unlisten(el, e, l) {
+ return el.removeEventListener(e, l, false)
+ }
+
+ function test (e) {
+ k[e.keyCode] = true;
+ unlisten(el, "keydown", test);
+ }
+
+ listen(el, "keydown", test);
+
+ listen(el, "keyup", function (e) {
+ listen(el, "keydown", test);
+ delete k[e.keyCode];
+ });
+
+ return function () {
+ return k;
+ };
+
+} (window));
+
+function isKeyDown(keyboard, key) {
+ return keyboard.hasOwnProperty(key);
+}
View
77 script/map.js
@@ -0,0 +1,77 @@
+var map;
+
+(function () {
+
+ "use strict";
+
+ function normalize(w) {
+ var s = 0;
+ return w.map(function (i) {
+ return s += i;
+ }).map(function (i) {
+ return i / s;
+ });
+ }
+
+ function rand(w, n) {
+ var v, p = 0, r = random();
+ w.some(function (e, i) {
+ if (p < r && n[i] > r) {
+ v = i;
+ return false;
+ }
+ p = n[i];
+ return true;
+ });
+ return v;
+ }
+
+ function fast(w, n) {
+ var p, r = random(), l = 0, h = n.length - 1;
+ while (l < h) {
+ p = ceiling((h + l / 2));
+ if (n[p] < r) {
+ l = p + 1;
+ } else if (n[p] > r) {
+ h = p - 1;
+ } else {
+ return p;
+ }
+ }
+ return (n[l] >= r) ? l : ((l != h) ? p : l + 1);
+ }
+
+ map = function (t, l, w, g) {
+ var i, j, m = new Array(t), n = normalize(w);
+ g == null && (g = id);
+ for (i = 0; i < t; i++) {
+ m[i] = new Array(t);
+ for (j = 0; j < t; j++) {
+ m[i][j] = g(l[fast(w, n)], i, j);
+ }
+ }
+ return m;
+ }
+
+} ());
+
+function drawMap(el, m) {
+ var h = ['<div class="map">'];
+ m.forEach(function (r, i) {
+ h.push('<div class="row" row="' + i + '">');
+ r.forEach(function (c, j) {
+ h.push('<div class="tile ' + c + '" column="' + j + '"></div>');
+ });
+ h.push("</div>");
+ });
+ write(el, h.concat("</div>").join(""));
+}
+
+function tile(x, y) {
+ return elem('div[row="' + ceiling(y) + '"] div[column="' + ceiling(x) + '"]');
+}
+
+function occupied(x, y) {
+ var t = tile(x, y);
+ return t ? t.classList.length > 1 : false;
+}
View
54 script/player.js
@@ -0,0 +1,54 @@
+var player = (function (s, p) {
+ var l, speed = s, position = initPosition = p;
+
+ function update(dt) {
+ var last = position, kb = Keyboard(), orientation, velocity;
+
+ orientation = [(function () {
+ if (isKeyDown(kb, 37)) {
+ delete kb[37];
+ return -1;
+ } else if (isKeyDown(kb, 39)) {
+ delete kb[39];
+ return 1;
+ }
+ return 0;
+ } ()), (function () {
+ if (isKeyDown(kb, 38)) {
+ delete kb[38];
+ return -1;
+ } else if (isKeyDown(kb, 40)) {
+ delete kb[40];
+ return 1;
+ }
+ return 0;
+ } ())];
+
+ velocity = orientation.map(function (o) {
+ return o * speed;
+ });
+
+ position = vect2dAdd(velocity, position);
+
+ if (!(inbounds(position[0], position[1]) && !occupied(position[0], position[1]))) {
+ position = last;
+ }
+ }
+
+ function draw() {
+ var el = elem(".player"), t = tile(position[0], position[1]);
+ if (t && l && l != position) {
+ tile(l[0], l[1]).removeChild(el);
+ }
+ if (t) {
+ t.appendChild(el);
+ l = position;
+ }
+ }
+
+ return {
+ update: update,
+ draw: draw
+ };
+
+} (1, [0, 0]));
View
44 script/utils.js
@@ -0,0 +1,44 @@
+"use strict";
+
+function id(x) {
+ return x;
+}
+
+function elem(id) {
+ return document.querySelector(id);
+}
+
+function write(el, txt) {
+ el.innerHTML = txt;
+}
+
+var now = Date.now;
+var random = Math.random;
+var ceiling = Math.ceil;
+var floor = Math.floor;
+
+function fixed(n, p) {
+ return n.toFixed(p);
+}
+
+function defer(f, t) {
+ t == null && (t = 0);
+ return setTimeout(f, t);
+}
+
+function fps(f, s, e) {
+ e == null && (e = now());
+ return f / ((e - s) / 1000);
+}
+
+function vect2dScale(v, s) {
+ return [v[0] * s, v[1] * s];
+}
+
+function vect2dAdd(a, b) {
+ return [a[0] + b[0], a[1] + b[1]];
+}
+
+function inbounds(x, y) {
+ return x < 8 && x >= 0 && y < 8 && y >= 0;
+}
View
40 style/style.css
@@ -0,0 +1,40 @@
+body {
+ margin: 0;
+ padding: 0;
+}
+
+.metrics {
+ position: absolute;
+ right: 0;
+}
+
+.row {
+ clear: both;
+ height: 64px;
+}
+
+.tile {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ background: url('../resources/grass.svg');
+ float: left;
+ height: 100%;
+ width: 64px;
+}
+
+.player {
+ background: url('../resources/octocat.svg');
+ height: 100%;
+ width: 100%;
+}
+
+.tile.block {
+ background: none;
+ background-color: gray;
+}
+
+.tile.monster {
+ background: none;
+ background-color: red;
+}

0 comments on commit 60ed016

Please sign in to comment.
Something went wrong with that request. Please try again.