Skip to content

Instantly share code, notes, and snippets.

View ehgoodenough's full-sized avatar

Andrew Goodenough ehgoodenough

View GitHub Profile
Derek Yu, Finishing a Game
http://makegames.tumblr.com/post/1136623767/finishing-a-game
Starting a Game
http://web.archive.org/web/20051104034215/http://www.lupinegames.com/articles/path_to_dev.html
Extra Credits, Fail Faster
https://www.youtube.com/watch?v=rDjrOaoHz9s
Side-Scrolling Cameras
@ehgoodenough
ehgoodenough / Frame.view.less
Created October 8, 2019 17:03
Fits your css rem into a viewport responsive aspect-ratio.
:root {
.aspect-ratio(16, 9);
}
.aspect-ratio(@width, @height) {
@media(min-aspect-ratio: @width ~"/" @height) {
font-size: ((@width / @height)* 100vh) / @width;
}
@media(max-aspect-ratio:@width ~"/" @height) {
@ehgoodenough
ehgoodenough / burstbubbles.js
Created July 12, 2019 01:26
BurstBubbles.js
// VALUES = [3, 1, 5, 8], EXPECTED_SCORE = 167
// VALUES = [ 9, 76, 64, 21, 97, 60 ], EXPECTED_SCORE = 1086136
VALUES = [35, 16, 83, 87, 84, 59, 48, 41, 20, 54], EXPECTED_SCORE = 1849648
// maxCoins = maximizeScoreViaSorting
// maxCoins = maximizeScoreViaThrees
maxCoins = maximizeScoreViaRecursion
console.log("Score:", maxCoins(VALUES))
console.log(" =", EXPECTED_SCORE + "?")
@ehgoodenough
ehgoodenough / GameScreen.view.js
Created April 24, 2019 20:13
3d blocks in css
import Preact from "preact"
import Index from "index.js"
import "views/screens/GameScreen.view.less"
export default class GameScreen {
render() {
return (
<div class="GameScreen">
<Camera>
@ehgoodenough
ehgoodenough / README.md
Created March 15, 2019 17:46
hypothetical cam library readme

Cam (name-pending)

A library for managing your camera.

Documentation

const camera = new Camera({
    "target": {"x": 2, "y": 2},
 "frame": {"width": 16, "height": 9},
* {
cursor: default;
user-select: none;
image-rendering: pixelated;
}
body {
background-color: #111;
}
@ehgoodenough
ehgoodenough / .eslintrc
Created December 17, 2016 21:41
boilerplate
{
"parser": "babel-eslint",
"rules": {
"camelcase": 1,
"indent": [1, 4],
"semi": [1, "never"],
"quotes": [1, "double"],
"brace-style": [1, "1tbs"],
"space-before-blocks": 2
}
// var Grunt = require("grunt")
module.exports = function(Grunt) {
Grunt.config.init({
clean: {
src: [
"builds"
]
},
watch: {
var blocks = new Object()
/////////////
// Server //
///////////
var minecraftdata = require("minecraft-data")("1.8.9")
var socketio = require("socket.io")()
var yargs = require("yargs")
function getDirection(x, y) {
var angle = Math.atan2(y, x)
return angle
}
function getDistance(x, y) {
return Math.sqrt(x*x + y*y) || 0
}
function getVector(p1, p2) {