Sky is Falling

This originally started when I did the Challenge: Bouncy Ball at Khan Academy and then I remembered from programming in college about using the acceleration of gravity and other properties of physics. I decided to add that formula of gravity so that the ball was bouncing more realistically. I then thought of more ways to make it better and cooler. I changed the colors and turned the ball into a moon and the background into a night sky. Then I added some stars.

To get the shape of the stars, I started with the code of the sun that I got from doing Challenge: Exploding Sun. The sun is a star, after-all. I gave the stars less points than my sun had to make them more star-like.

I eventually made it so that, each time the script runs, the starting position of each star, the size of each star, the color of each star, the horizontal speed and direction of each star, are all randomly generated. My engineer husband said that they could have some rotation too. Maybe I'll add that later.

And, if you were curious, there are 50 stars. I suppose that I could make the program randomize the number of stars and make a horrible game out of having you count them. haha. Perhaps you could help a little chicken dodge them all.

1 comment: