Skip to content

Instantly share code, notes, and snippets.

@lucas-jones
Created May 2, 2019 08:17
Show Gist options
  • Save lucas-jones/3e4e4e129a1a14f1403202e249c190bd to your computer and use it in GitHub Desktop.
Save lucas-jones/3e4e4e129a1a14f1403202e249c190bd to your computer and use it in GitHub Desktop.
interface Config {
boxColor: number,
backgroundColor: number,
modelUrl: string,
}
class Game {
options: Config;
constructor(options: Config) {
this.options = options;
this.makeBox(this.options.boxColor);
this.makeBg(this.options.backgroundColor);
}
makeBox(col:number) {
// .. create box
}
makeBg(col:number) {
// .. make background
}
}
const redWorld: Config = {
backgroundColor: 0xff0000,
boxColor: 0xff0000,
modelUrl: ".../"
}
const blueWorld: Config = {
backgroundColor: 0x0000ff,
boxColor: 0x0000ff,
modelUrl: ".../dave"
}
new Game(redWorld);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment