| 60 | classes: string[]; |
| 61 | |
| 62 | constructor([show, type, asset, sprite, ...classes]: string[]) { |
| 63 | super(); |
| 64 | this.asset = asset; |
| 65 | |
| 66 | this.state = this.engine.state('characters').find((statement: string) => { |
| 67 | const [show, character, asset, name] = statement.split(' '); |
| 68 | return asset === this.asset; |
| 69 | }); |
| 70 | |
| 71 | if (typeof this.engine.character(asset) !== 'undefined') { |
| 72 | // show [character] [expression] at [position] with [animation] [infinite] |
| 73 | this.sprite = sprite; |
| 74 | |
| 75 | this.character = this.engine.character(asset); |
| 76 | this.image = this.character.sprites[this.sprite]; |
| 77 | |
| 78 | if (typeof classes !== 'undefined') { |
| 79 | this.classes = ['animated', ...classes.filter((item) => item !== 'at' && item !== 'with')]; |
| 80 | } else { |
| 81 | this.classes = []; |
| 82 | } |
| 83 | |
| 84 | } else { |
| 85 | this.sprite = ''; |
| 86 | this.classes = []; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | override async willApply(): Promise<void> { |
| 91 | if (typeof this.character === 'undefined') { |