function makePac() {
  // make sure we are ready to start movement again
  stopMovement = false;

  // returns an object with random values scaled {x: 33, y: 21}
  let velocity = setToRandom(50); // {x:?, y:?}
  let position = {};
  let direction = 0; // 0 = left to right, 1 = right to left
  let focus = 0; // Toggle among PacMan images

  // Add image to div id = game
  let game = document.getElementById("game");
  let newimg = document.createElement("img");
  newimg.style.position = "absolute";
  newimg.src = pacArray[0][0];
  newimg.width = 100;
  newimg.height = 100;

  // set position here
  position.x = Math.random() * (gameBoardWidth - newimg.width);
  position.y = Math.random() * (gameBoardHeight - newimg.height);

  newimg.style.left = position.x;
  newimg.style.top = position.y;

  // Tadd new Child image to game
  game.appendChild(newimg);

  // return details in an object
  return {
    position,
    velocity,
    newimg,
    direction,
    focus,
  };
}
// makes a PacMan at a random position with random velocity
makes a PacMan at a random position with random velocity
makes a PacMan at a random position with random velocity
function makePac() {
  stopMovement = false;
  let velocity = setToRandom(50); 
  let position = {};
  let direction = 0; 
  let focus = 0; 
  let game = document.getElementById("game");
  let newimg = document.createElement("img");
  newimg.style.position = "absolute";
  newimg.src = pacArray[0][0];
  newimg.width = 100;
  newimg.height = 100;
  position.x = Math.random() * (gameBoardWidth - newimg.width);
  position.y = Math.random() * (gameBoardHeight - newimg.height);
  newimg.style.left = position.x;
  newimg.style.top = position.y;
  game.appendChild(newimg);
  return {
    position,
    velocity,
    newimg,
    direction,
    focus,
  };
}
function makePac ( ) { stopMovement = false ; let velocity = setToRandom ( 50 ) ; let position = { } ; let direction = 0 ; let focus = 0 ; let game = document . getElementById ( "game" ) ; let newimg = document . createElement ( "img" ) ; newimg . style . position = "absolute" ; newimg . src = pacArray [ 0 ] [ 0 ] ; newimg . width = 100 ; newimg . height = 100 ; position . x = Math . random ( ) * ( gameBoardWidth - newimg . width ) ; position . y = Math . random ( ) * ( gameBoardHeight - newimg . height ) ; newimg . style . left = position . x ; newimg . style . top = position . y ; game . appendChild ( newimg ) ; return { position , velocity , newimg , direction , focus , } ; }
makes a PacMan at a random position with random velocity
makes a PacMan at a random position with random velocity
// make sure we are ready to start movement again // returns an object with random values scaled {x: 33, y: 21} // {x:?, y:?} // 0 = left to right, 1 = right to left // Toggle among PacMan images // Add image to div id = game // set position here // Tadd new Child image to game // return details in an object