Skip to content

Commit

Permalink
Move back to phaser
Browse files Browse the repository at this point in the history
  • Loading branch information
kevglass committed Nov 11, 2024
1 parent 01dfec7 commit e9ae266
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import oAssetUrl from "./assets/o.svg";
// for a more complete physics based example check out
// the Rune Phaser Tech Demo https://developers.rune.ai/blog/phaser/

const sound: HTMLAudioElement = new Audio(selectSoundAudio);

// simple example for Phaser and Rune combined
class TicTacToe extends Phaser.Scene {
boardPosition = { x: window.innerWidth / 20, y: window.innerHeight / 20 };
Expand All @@ -29,6 +27,7 @@ class TicTacToe extends Phaser.Scene {
preload() {
this.load.image("x", xAssetUrl);
this.load.image("o", oAssetUrl);
this.load.audio("select", selectSoundAudio);
}

create() {
Expand Down Expand Up @@ -101,7 +100,8 @@ class TicTacToe extends Phaser.Scene {
}

Rune.initClient({
onChange: ({ game, yourPlayerId, allPlayerIds, event }) => {
onChange: ({ game, yourPlayerId, action, allPlayerIds, event }) => {
console.log(action, event)

Check warning on line 104 in src/client.ts

View workflow job for this annotation

GitHub Actions / Publish to GitHub Pages

Insert `;`
const { cells, lastMovePlayerId } = game;

// we're starting a new game so reset everything in the UI
Expand Down Expand Up @@ -164,7 +164,7 @@ class TicTacToe extends Phaser.Scene {
placed.setScale((this.cellSize * 0.8) / placed.width);
this.cellImages[i] = placed;
// play a sound effect each time a cell is placed
sound.play()
this.sound.play("select");
}
}

Expand Down

0 comments on commit e9ae266

Please sign in to comment.