local players={}

function Spawnplayer(x,y,type,itable)
  
  local player={}
  
  player.x=x
  player.y=y
  player.name=itable.id
  player.stats=itable.istats
  player.sprite=itable.isprite
  player.priority=itable.priority
  
  player.wspeed=1.5
  player.rspeed=2.9
  player.fbrake=7
  
  require("Source.Classes.Entities."..type)
    
  function player.setorder()

  end
    
  function player.update(dt)
  
  end
  
  function player.draw()
  
  end
  
  table.insert(players,player)

end

function players.update(dt)

  for i in pairs(players) do
  
    if i.priority and Substate.static==false then
    
      local facing=Physics.movecoder(key.firstcmd(Global.Key.list,"movement",2))
      
      if facing=="up" then
      
        love.graphics.draw(i.sprite.base,i.sprite[facing],i.x,i.y)
      
      end
      
      if facing=="right" then
      
        love.graphics.draw(i.sprite.base,i.sprite[facing],i.x,i.y)
      
      end
      
      if facing=="down" then
      
        love.graphics.draw(i.sprite.base,i.sprite[facing],i.x,i.y)
      
      end
      
      if facing=="left" then
      
        love.graphics.draw(i.sprite.base,i.sprite[facing],i.x,i.y)
      
      end
      
      if facing=="up-right" then
      
        love.graphics.draw(i.sprite.base,i.sprite[facing],i.x,i.y)
      
      end
      
      if facing=="right-down" then
      
        love.graphics.draw(i.sprite.base,i.sprite[facing],i.x,i.y)
      
      end
      
      if facing=="down-left" then
      
        love.graphics.draw(i.sprite.base,i.sprite[facing],i.x,i.y)
      
      end
      
      if facing=="left-up" then
      
        love.graphics.draw(i.sprite.base,i.sprite[facing],i.x,i.y)
      
      end
    
    end
  
  end

end

function players.draw()

end
