Schloool/Engine
Aus ProgrammingWiki
Wiki-Quelltext dieser Seite.
<language>Javascript</language>
----
<p>Eine Game-Engine repräsentiert eine Grundlage, auf der man Spiele entwickelt. Für meine Games im Wiki binde ich diese Engine ein.</p>
<br/>
<code id="Game">
class Game {
constructor(canvas, width, height) {
this.canvas = canvas;
this.width = width;
this.height = height;
}
setBackground(r, g, b) {
this.canvas.setColor(r, g, b);
this.canvas.fillRect(0, 0, this.width, this.height);
}
setBackground(color) {
this.canvas.setColor(color);
this.canvas.fillRect(0, 0, this.width, this.height);
}
}
</code>