A library for managing your camera.
const camera = new Camera({
"target": {"x": 2, "y": 2},
"frame": {"width": 16, "height": 9},
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 |
: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) { |
// 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 + "?") |
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> |
* { | |
cursor: default; | |
user-select: none; | |
image-rendering: pixelated; | |
} | |
body { | |
background-color: #111; | |
} |
{ | |
"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) { |