Code to consider for Unit 6 Lesson 8 Emoji Game

 


onEvent("play", "click", function(event) {
     startGame();
   });
   
onEvent("replay", "click", function(event) {
     startGame();
   });

onBoardEvent(buttonL, "press", function(event) {
     movePlayer("red");
     checkWin("red");
   });

onBoardEvent(buttonR, "press", function(event) {
     movePlayer("blue");
     checkWin("blue");
   });

function startGame() {
     // Move both players to the top of the screen
     
     // Switch to the "game" screen
     
   }

function movePlayer(player) {
     // Get the "y" property of the player
     // and assign it to the variable player_y
     var player_y = __;
     
     // Increase player_y by 10
     
     // Set the player's y property to the
     // new player_y value
     
   }

function checkWin(player) {
     // Get the "y" property of the player
     // and assign it to the variable player_y
     
     // Check if player has reached the bottom.
     // If it has, announce the winner.
     
   }