2021-05-18 11:33:16 +02:00
|
|
|
import * as tg from "generic-type-guard";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const isHasPlayerMovedEvent =
|
|
|
|
new tg.IsInterface().withProperties({
|
2021-05-25 17:21:02 +02:00
|
|
|
direction: tg.isElementOf('right', 'left', 'up', 'down'),
|
2021-05-18 11:33:16 +02:00
|
|
|
moving: tg.isBoolean,
|
|
|
|
x: tg.isNumber,
|
|
|
|
y: tg.isNumber
|
|
|
|
}).get();
|
|
|
|
|
|
|
|
/**
|
2021-05-25 11:02:25 +02:00
|
|
|
* A message sent from the game to the iFrame to notify a movement from the current player.
|
2021-05-18 11:33:16 +02:00
|
|
|
*/
|
|
|
|
export type HasPlayerMovedEvent = tg.GuardedType<typeof isHasPlayerMovedEvent>;
|
|
|
|
|
|
|
|
|
|
|
|
export type HasPlayerMovedEventCallback = (event: HasPlayerMovedEvent) => void
|