MDN self-hosted library · e01.org

Implementing game control mechanisms

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
function create() {
  // …
  const buttonEnclave = this.add.button(
    10,
    10,
    "logo-enclave",
    this.clickEnclave,
    this,
  );
  // …
}
js
function update() {
  // …
  if (this.game.input.mousePointer.isDown) {
    // do something
  }
  // …
}