   create: ->
     @dudesById = {}
     @myId = '555'
-
-    @game.physics.startSystem(Phaser.Physics.ARCADE)
 
     @dudes = @game.add.group()
     @player = @addDude(@myId, 0, 0, 'nigel')

  destroy:->

  preload:->
    @game.input.gamepad.start
    @pads = [
      @game.input.gamepad.pad1,
      @game.input.gamepad.pad2,
      @game.input.gamepad.pad3,
      @game.input.gamepad.pad4
    ]
    @game.load.spritesheet('nigel', 'assets/nigel.png', 32, 32)

  loadRender:->

    dude.position.y = y

  update:->
    moves = @pollController()
    if (moves.left)
      @player.body.velocity.x = -150
    if (moves.right)
      @player.body.velocity.x = 150
    if (moves.up)
      @player.body.velocity.y = -150
    if (moves.down)
      @player.body.velocity.y = 150

    animation = "idle"
    if Math.abs(@player.body.velocity.x) > Math.abs(@player.body.velocity.y)
      if @player.body.velocity.x > 25
        animation = "right"
      else if @player.body.velocity.x < -25
        animation = "left"
    else
      if @player.body.velocity.y > 25
        animation = "down"
      else if @player.body.velocity.y < -25
        animation = "up"
    @player.animations.play(animation)

    @player.body.velocity.x *= 0.95
    @player.body.velocity.y *= 0.95

    @sendUpdate(@myId, @player.body.x, @player.body.y)

  pollController:=>
    moves =
      up: false
      down: false
      left: false
      right: false
      but1: false
      but2: false
      but3: false
      but4: false

#   _.each @pads, (pad)=>
#     if pad.axis(Phaser.Gamepad.XBOX360_STICK_LEFT_Y) < -0.8 or
#        pad.axis(Phaser.Gamepad.XBOX360_STICK_RIGHT_Y) < -0.8 or
#        pad.isDown(Phaser.Gamepad.XBOX360_DPAD_UP)
#       moves.up = true
#     if pad.axis(Phaser.Gamepad.XBOX360_STICK_LEFT_Y) > 0.8
#        pad.axis(Phaser.Gamepad.XBOX360_STICK_RIGHT_Y) > 0.8 or
#        pad.isDown(Phaser.Gamepad.XBOX360_DPAD_DOWN)
#       moves.down = true
#     if pad.axis(Phaser.Gamepad.XBOX360_STICK_LEFT_X) < -0.8
#        pad.axis(Phaser.Gamepad.XBOX360_STICK_RIGHT_X) < -0.8 or
#        pad.isDown(Phaser.Gamepad.XBOX360_DPAD_LEFT)
#       moves.left = true
#     if pad.axis(Phaser.Gamepad.XBOX360_STICK_LEFT_X) > 0.8
#        pad.axis(Phaser.Gamepad.XBOX360_STICK_RIGHT_X) > 0.8 or
#        pad.isDown(Phaser.Gamepad.XBOX360_DPAD_RIGHT)
#       moves.right = true
#     if pad.isDown(Phaser.Gamepad.XBOX360_Y)
#       moves.but1 = true
#     if pad.isDown(Phaser.Gamepad.XBOX360_A)
#       moves.but2 = true
#     if pad.isDown(Phaser.Gamepad.XBOX360_X)
#       moves.but2 = true
#     if pad.isDown(Phaser.Gamepad.XBOX360_B)
#       moves.but2 = true

    if @kb.isDown(Phaser.Keyboard.UP)
      moves.up = true
    if @kb.isDown(Phaser.Keyboard.DOWN)
      moves.down = true
    if @kb.isDown(Phaser.Keyboard.LEFT)
      moves.left = true
    if @kb.isDown(Phaser.Keyboard.RIGHT)
      moves.right = true
    if @kb.isDown(Phaser.Keyboard.W)
      moves.but1 = true
    if @kb.isDown(Phaser.Keyboard.S)
      moves.but1 = true
    if @kb.isDown(Phaser.Keyboard.A)
      moves.but1 = true
    if @kb.isDown(Phaser.Keyboard.D)
      moves.but1 = true

    moves

  sendUpdate:(id, x, y) ->
    _.each @allPeers, (connection)->
