Last active
April 16, 2016 19:50
-
-
Save ollybritton/17c66c3dc996b1b58aef010f36048d1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (i = 0; i < 1001; i++) { | |
(function(i){ | |
setTimeout(function(){ | |
var star = stars.create(Math.floor(Math.random() * 20 + 1 + currentX ), | |
Math.floor(Math.random() * 120 + 100 ), 'star'); | |
// Create Starts That Rain Above Player With A Bit Of 'Noise' (x, y, type) | |
star.body.gravity.y = 300; | |
// Set The Gravity To Make Them Fall Faster | |
star.body.bounce.y = 0.7 + Math.random() * 0.2; | |
// Make Them Bounce A Bit | |
}, Math.floor(Math.random() * 400 + 100) /* <-- Adding a bit of 'noise' to the delay. */ * i); | |
}(i)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment