Skip to content

Instantly share code, notes, and snippets.

@dfalmeida
Created March 9, 2018 16:08
Show Gist options
  • Save dfalmeida/08ce81166197bd5977c0d4930570ee95 to your computer and use it in GitHub Desktop.
Save dfalmeida/08ce81166197bd5977c0d4930570ee95 to your computer and use it in GitHub Desktop.
func sendActions(with player: Player) {
WebSocket.instance.sendMessage(with: "game:slimeSoccer",
event: "playerAction",
payload: [
"player" : player.id,
"jump": player.isJumping,
"left": player.isMovingLeft,
"right": player.isMovingRight,
"x": player.sprite?.position.x as Any,
"y": player.sprite?.position.y as Any],
onSuccess: { (message) in },
onError: { (reason) in })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment