blob: 1be85dd546e0a7d6ac585f2a8c2380a223fdc552 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import type Phaser from 'phaser';
type Sprite = Phaser.Types.Physics.Arcade.SpriteWithDynamicBody;
type PlayerConfig = {
name: string,
position: {x: number, y: number}
}
type Input = {
cursors: Phaser.Types.Input.Keyboard.CursorKeys,
}
export default class Player
{
name: string
position: {x:number, y: number}
sprite: Sprite | undefined;
input: Input | undefined;
constructor({name, position}: PlayerConfig) {
this.name = name;
this.position = position
}
setSprite(sprite: Sprite) {
this.sprite = sprite;
}
setInput(input: Input) {
this.input = input;
}
}
|