Versionsvergleich

Aus ProgrammingWiki

Vergleich: 2019-10-21T21:34:59+00:00 → 2019-11-23T14:15:49+00:00

<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.
−
So eine Grundlagen nutzen Programmierer oft, um wiederkehrende Funktionen nicht immer neu implementieren zu müssen. Man spricht dabei auch von "Bibliotheken".
−
</p>
−
<br/>
−
−
<code id="Game">
−
function Game(canvas, width, height) {
−
−
  this.canvas = canvas;
−
  this.width = width;
−
  this.height = height;
−
−
  this.setBackground = function(r, g, b) {
−
    this.canvas.setColor(r, g, b);
−
    this.canvas.fillRect(0, 0, this.width, this.height);
−
  };
−
−
  this.setBackground = function(color) {
−
    this.canvas.setColor(color);
−
    this.canvas.fillRect(0, 0, this.width, this.height);
−
  };
−
−
}
−
</code>