Skip to content

Instantly share code, notes, and snippets.

@dpogorzelski
Last active August 29, 2015 13:56
Show Gist options
  • Save dpogorzelski/9298461 to your computer and use it in GitHub Desktop.
Save dpogorzelski/9298461 to your computer and use it in GitHub Desktop.
type Message struct {
Y int // current Y position
X int // as above
Id string // the id of the player that sent the message
New bool // true if this player just connected so we know when to
// spawn a new sprite on the screens of the other players. for all subsequent
// messages it's false
Online bool // true if the player is no longer connected so the frontend
// will remove it's sprite
}
type Player struct {
Y int // Y position of the player
X int // X position
Id string // a unique id to identify the player by the frontend
Socket *websocket.Conn // websocket connection of the player
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment