diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2021-07-21 16:48:47 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2021-07-21 16:48:47 +0200 |
| commit | 5d76a30aeba5bfd175b60845c4935c4352b46f4c (patch) | |
| tree | 0b3bb79bb71fca8b412a168147d941d3f3f13131 /client | |
| parent | da613e94970da31409464c81740162f9bd7c7831 (diff) | |
feat(): heartbeat working on remote engine
Diffstat (limited to 'client')
| -rw-r--r-- | client/src/RemotePlayerEngine.ts | 14 | ||||
| -rw-r--r-- | client/src/RemotePlayerSprite.ts | 1 | ||||
| -rw-r--r-- | client/src/scene.ts | 11 |
3 files changed, 22 insertions, 4 deletions
diff --git a/client/src/RemotePlayerEngine.ts b/client/src/RemotePlayerEngine.ts new file mode 100644 index 0000000..f19ebe0 --- /dev/null +++ b/client/src/RemotePlayerEngine.ts @@ -0,0 +1,14 @@ +import Phaser from 'phaser'; +import { akkamonClient } from './app'; + +export class RemotePlayerEngine { + + private scene: Phaser.Scene + + constructor(scene: Phaser.Scene) { + this.scene = scene; + } + + update() { + } +} diff --git a/client/src/RemotePlayerSprite.ts b/client/src/RemotePlayerSprite.ts new file mode 100644 index 0000000..8485803 --- /dev/null +++ b/client/src/RemotePlayerSprite.ts @@ -0,0 +1 @@ +import Phaser from 'phaser'; diff --git a/client/src/scene.ts b/client/src/scene.ts index 29bf253..52edbdd 100644 --- a/client/src/scene.ts +++ b/client/src/scene.ts @@ -1,12 +1,14 @@ import Phaser from 'phaser'; import { akkamonClient } from './app'; -import type { GameState } from './GameState'; import { Player } from './player'; import { PlayerSprite } from './sprite'; + import { GridControls } from './GridControls'; import { GridPhysics } from './GridPhysics'; import { Direction } from './Direction'; +import { RemotePlayerEngine } from './RemotePlayerEngine'; + type RemotePlayerStates = { [name: string]: Player @@ -17,10 +19,11 @@ export default class AkkamonStartScene extends Phaser.Scene static readonly TILE_SIZE = 32; - private akkamonState?: GameState private gridPhysics?: GridPhysics private gridControls?: GridControls + private remotePlayerEngine?: RemotePlayerEngine + directionToAnimation: { [key in Direction]: string } = { @@ -81,8 +84,6 @@ export default class AkkamonStartScene extends Phaser.Scene // Create a sprite with physics enabled via the physics system. The image used for the sprite has // a bit of whitespace, so I'm using setSize & setOffset to control the size of the player's body. - this.akkamonState = akkamonClient.getMutableState(); - var tilePos = new Phaser.Math.Vector2( Math.floor(this.spawnPoint.x! / AkkamonStartScene.TILE_SIZE), Math.floor(this.spawnPoint.y! / AkkamonStartScene.TILE_SIZE), @@ -106,6 +107,8 @@ export default class AkkamonStartScene extends Phaser.Scene this.gridPhysics ); + this.remotePlayerEngine = new RemotePlayerEngine(this); + this.createPlayerAnimation(Direction.LEFT, 0, 3); this.createPlayerAnimation(Direction.RIGHT, 0, 3); this.createPlayerAnimation(Direction.UP, 0, 3); |
