

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Asteroids
incomplete
2: Collisions
incomplete
3: Shooting
incomplete
4: Rate Limit
incomplete
5: Destruction
incomplete
6: Splitting
incomplete
7: Submit Your Repo
incomplete
This lesson's interactive features are locked, please to keep using them
In the original game of Asteroids, part of the challenge comes from the fact that larger asteroids split into smaller, faster asteroids when you shoot them. Let's support that!
Large asteroids split into two medium asteroids
Medium asteroids split into two small asteroids
Small asteroids disappear when destroyed
After splitting, the new smaller asteroids move faster.
After splitting, the new smaller asteroids move in new random directions. For example, in the diagram:
A new angle for the new asteroids is chosen at random (between 20 and 50 degrees), then the new asteroids are created and start moving in those directions.
Instead of using asteroid.kill() in our game loop, we'll create and use a new asteroid.split() method.
Add a new .split() method to the Asteroid class. It should:
If things seem to be working, run and submit the CLI tests.