Created
August 26, 2015 08:21
-
-
Save justjake/30fb88c9c432e95f6f1a to your computer and use it in GitHub Desktop.
4chan tried to make a monopoly game in a live codepad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// install gentoo | |
// https://boards.4chan.org/g/thread/49913571/so-g-has-never-made-a-project-in-their-lives-so | |
// http://codeshare.io/sqjc2 | |
const clover = '//s.4cdn.org/image/buttons/burichan/watch_thread_off.png'; | |
// @param {String} url - load image from here | |
// @return {Promise<Sprite>} herp derp | |
function loadSprite(url) { | |
return new Promise((resolve, reject) => { | |
const img = new Image(); | |
// mdn suggests this ordering... unknown if it is necessary | |
img.addEventListener('load', () => resolve(new Sprite(0, 0, img))); // No i mean the codeshare platform/// wha?????? lol | |
img.src = url | |
}) | |
} | |
function createContext() { | |
const canv = document.createElement('canvas'); | |
documnet.appendElement(canv); | |
return canv.getContext('2D'); | |
} | |
function checkOP() { | |
return "OP is batshit insane"; | |
} | |
class Entity { | |
// render this entity as a scene | |
// @return Array<Sprite> | |
render() { | |
// fuck we need some sprites yo | |
} | |
} | |
/*soo desu nee~黒人 | |
kawaii uguu~ | |
Sur*priced this shit isn't deleted already */ | |
class Sprite { | |
constructor(x, y, image) { | |
this.x = x; | |
this.y = y; | |
this.image = image; | |
} | |
} | |
// feel free to pseudocode, or write in ruby or something. i will fix syntax if need be. | |
class Board { | |
} | |
class Card { | |
this.name = name; | |
this.action = action; | |
this.sprite = sprite; | |
} | |
/** | |
* an easy representation of a scene is just a list of sprites from back to front. | |
* we might extend this in the future into an object with more fields | |
* but for now this is fine. | |
* @see https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Using_images#Example_A_simple_line_graph | |
*/ | |
function render(sprites, context) { | |
sprites.forEach(s => context.drawImage(s.image, s.x, s.y)); | |
} | |
function main() { | |
string mootspritefilepathnameaddress = "http://s.4cdn.org/image/title/100.jpg"; | |
const context = makeContext(); | |
loadSprite(clover).then(sprite => { | |
// just fuck my shit up ASAP | |
// A+ change, lgtm, would stamp in code review | |
render([sprite], context); | |
}) | |
//that moment when you clench your anus as somebody highlights the whole project | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment