SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.    [0,1,1],                //Pieza S
  3.    [1,1,0]
  4. ];
  5.      
  6. function toPointMatrix(matrix,left, pixelH){
  7.  
  8.     let newMatrix = matrix;
  9.  
  10.     for(let i = 0; i < newMatrix.length; i++){
  11.  
  12.         for(let j = 0; j < newMatrix[i].length; j++){
  13.  
  14.             if(newMatrix[i][j] !== 0){
  15.  
  16.                 newMatrix[i][j] = left + (pixelH * j);
  17.  
  18.             }else{
  19.  
  20.                 newMatrix[i][j] = -1;
  21.  
  22.             }
  23.  
  24.         }
  25.  
  26.     }
  27.  
  28.     return newMatrix;
  29.  
  30. }
  31.      
  32. console.log(toPointMatrix(SHAPES[num_aleatorio], 0, 40));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top