function makePac() {
        // returns an object with random values scaled {x: 33, y: 21}
        let velocity = setToRandom(10); // {x:?, y:?}
        let position = setToRandom(200);
        // Add image to div id = game
        let game = document.getElementById('game');
        let newimg = document.createElement('img');
        newimg.style.position = 'absolute';
        newimg.src = './images/PacMan1.png';
        newimg.width = 100;
        //
        // set position here 
        //
        newimg.style.left = position.x;
        newimg.style.top = position.y;
        // add new Child image to game
        game.appendChild(newimg);
        // return details in an object
        return {
            position,
            velocity,
            newimg
        }
    }
// Factory to make a PacMan at a random position with random velocity
Factory to make a PacMan at a random position with random velocity
Factory to make a PacMan at a random position with random velocity
function makePac() {
        let velocity = setToRandom(10); 
        let position = setToRandom(200);
        let game = document.getElementById('game');
        let newimg = document.createElement('img');
        newimg.style.position = 'absolute';
        newimg.src = './images/PacMan1.png';
        newimg.width = 100;
         set position here 
        newimg.style.left = position.x;
        newimg.style.top = position.y;
         add new Child image to game
        game.appendChild(newimg);
         return details in an object
        return {
            position,
            velocity,
            newimg
        }
    }
function makePac ( ) { let velocity = setToRandom ( 10 ) ; let position = setToRandom ( 200 ) ; let game = document . getElementById ( 'game' ) ; let newimg = document . createElement ( 'img' ) ; newimg . style . position = 'absolute' ; newimg . src = './images/PacMan1.png' ; newimg . width = 100 ; newimg . style . left = position . x ; newimg . style . top = position . y ; game . appendChild ( newimg ) ; return { position , velocity , newimg } }
Factory to make a PacMan at a random position with random velocity
Factory to make a PacMan at a random position with random velocity
// returns an object with random values scaled {x: 33, y: 21} // {x:?, y:?} // Add image to div id = game // // set position here  // // add new Child image to game // return details in an object