Skip to content

olivierrr/multiplayer-snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multiplayer-snake

###live here!

client api

api is exposed on client as a global, so you can script Ai's from your console!

known Ai's

game.on('input', data)

  • data.grid {Array#2d}
  • data.snakes {Array}
    • contains all snakes coordinates and names
  • data.foods {Array} food blocks within model
    • contains all food blocks coordinates
  • data.events {Array}
    • each event object has a type and a coordinates property
    • possible types are:
      • 'snake-die' triggered when you die
      • 'snake-eat' triggered when your snake collides with a food block
      • 'snake-kill' triggered when a snake (not yours) collides with your snake

game.emit('output', direction)

  • direction {String}
    • can be 'UP' | 'RIGHT' | 'LEFT' | 'DOWN'

game.emit('spawn')

  • spawns your snake at a random location
  • your snake must be dead

About

Multiplayer game of snake

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published