We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spelet behöver en Level-class med konstruktor. Jag tänker mig något liknande följande:
// js/level.js function Level(opts) { this.entities = []; this.nr = opts.nr || 1; this.trollCount = opts.trollCount || 1; this.spiderCount = opts.spiderCount || 5; } Level.prototype.addSpider = function () { this.entities.push(new Spider); };
// js/game.js function Game() { ... this.level = new Level({ nr: 1 }); ... } Game.prototype.nextLevel = function () { var opts; var nextLevelNr = this.level.nr + 1; switch (nextLevelNr) { case 2: opts = { trollCount: 2, spiderCount: 5 }; break; case 3: opts = { trollCount: 1, spiderCount: 10 }; break; case 4: opts = { trollCount: 3, spiderCount: 5 }; break; default: opts = { trollCount: 10, spiderCount: 20 }; break; } opts.nr = nextLevelNr; this.level = new Level(opts); };
The text was updated successfully, but these errors were encountered:
Jag håller på med denna
Sorry, something went wrong.
No branches or pull requests
Spelet behöver en Level-class med konstruktor. Jag tänker mig något liknande följande:
The text was updated successfully, but these errors were encountered: