Skip to content

Instantly share code, notes, and snippets.

@Tom32i
Last active August 9, 2016 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tom32i/95362d6d6e767ecde85e005ffa4094f9 to your computer and use it in GitHub Desktop.
Save Tom32i/95362d6d6e767ecde85e005ffa4094f9 to your computer and use it in GitHub Desktop.

Curvytron events

Events are JSON arrays, sent through websocket connexion, following that format:

[name, data, callbackID]

Get client ID

[["whoami",null,0]]

Fetch room list

[["room:fetch"]]

Join a room

[["room:join",{"name":"The wonderful game","password":null},1]]

Adds a player

[["player:add",{"name":"Tom32i","color":"#1dad93"},2]]

Set player ready (player action)

[["room:ready",{"player":1},3]]

Browser has loaded the game

[["ready"]]

Set player movement -1: turn left, 1: turn right or 0: go straight

[["player:move",{"avatar":1,"move":1}]]	
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment