MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / fallDown

Function fallDown

assets/js/AppleGameController.js:22–36  ·  view source on GitHub ↗

* Makes the provided element fall down by changing the top property. * @param {HTMLElement} apple

(apple)

Source from the content-addressed store, hash-verified

20 * @param {HTMLElement} apple
21 */
22function fallDown(apple) {
23 if (!(IsPlaying && apple instanceof HTMLElement)) {
24 return;
25 }
26 //store the current top position for future refrence.
27 apple.setAttribute('data-top', apple.style.top);
28 //change the top position, this is animated using transition property in CSS
29 apple.style.top = "380px";
30 //increase score
31 score = score + 5;
32 //show the score by calling this function
33 renderScore();
34 //hide the apple after it reaches the ground by calling this function
35 hideFallenApple(apple);
36}
37
38/**
39 * Hides the provided element by changing the display property.

Callers

nothing calls this directly

Calls 2

renderScoreFunction · 0.85
hideFallenAppleFunction · 0.85

Tested by

no test coverage detected