Skip to content

Instantly share code, notes, and snippets.

View kari112's full-sized avatar

Nikola kari112

View GitHub Profile
@kari112
kari112 / index.js
Created October 12, 2016 12:38
requirebin sketch
/*-----------------------------------------------------------------------------
REQUIRE
-----------------------------------------------------------------------------*/
var yo = require('yo-yo')
var minixhr = require('minixhr')
var csjs = require('csjs-inject')
/*-----------------------------------------------------------------------------
THEME
-----------------------------------------------------------------------------*/
// coolors.co
@kari112
kari112 / index.js
Created October 11, 2016 12:12
requirebin sketch
var yo = require('yo-yo')
var csjc = require('csjs-inject')
//var domElement = yo <html string>
var css= csjc`
body{
background-color:hsla(164,95%,43%,1);
}
h1{
color:hsla(30,100%,99%,1);
function summonHero (name, position) {
return {
say: function (sentence) {
alert(sentence);
},
move: function (position) {
console.log('Moving to x=' + position.x + ' and y=' +position.y);
this.pos = position;
},
name: name,
while (this.gold < 81) {
var coin = this.findNearest(this.findItems());
this.move(coin.pos);
}
if (this.gold > this.costOf("soldier")) {
this.summon("soldier");
}
for (var i=0; i < 4; i++) {
//FIND FARTHEST
var enemy;
loop {
var farthest = null;
var maxDistance = 0;
var enemyIndex = 0;
var enemies = this.findEnemies();
while (enemyIndex < enemies.length) {
var target = enemies[enemyIndex];