Zum Server verbinden:
init("Spielername");
connect-Event:
event.detail = {
rooms: [string],
};
In Raum beitreten/Raum erstellen:
login("Raum-ID");
update-Event:
event.detail = {
players: [
{
color: string,
direction: Direction,
id: number,
name: string,
score: number,
tail: [
{
x: number,
y: number,
},
],
x: number,
y: number,
},
],
room: {
apple: {
x: number,
y: number,
},
},
};
setDirection(Direction.UP);