| Level Navigation: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18⚡ | 19 |
User Story: As a player, I want the apple to appear in different locations so that I have to search for it and the game is more engaging.
Add state variables for apple position and randomize the position on each interaction.
appleX and appleY with initial value of 0randomSpot() function that:
appleX to a random value between 0 and 400appleY to a random value between 0 and 600randomSpot() in both clickTarget and missTarget functionsleft and top properties to the appleStyle object💪 Practice Challenge: This level is similar to Level 7. Try to complete it on your own using the same patterns!
CSS Positioning Review:
position: absolute allows us to place elements anywhereleft sets distance from the left edgetop sets distance from the top edge