Glowing Particles
Use the starter file below, and fill in the commented portions.
To see more on lists, check out these notes!
To see more on lists, check out these notes!
glowingobjects_starter_.zip |
OR
Create a brand new scenario for this project
Part 1 - The Setup
Create a brand new scenario for this project
Part 1 - The Setup
- Create a new subclass of World called Space which has a black background. Make the dimensions of the world 800 by 700.
- A Light particle is a white circle with diameter of 10 pixels. At start-up, there is one Light object positioned at the middle of the world.
- Particles are randomly coloured circles with diameter of 5 pixels. There are 100 particles in the world at start-up. They are positioned randomly throughout the world.
- Glowing objects are 5x5 sized ovals. The constructor of this class will pick a random colour for the particle and set it to that colour when it is created,
- These objects do not move, but they can glow. When they are glowing, they become opaque. Their transparency eventually returns to 0.
- The Light object moves based on the left and right keys pressed.
- When the Light object comes within 200 pixels of a particle, it makes the particle glow. For this, you will need to use the getObjectsInRange method, which returns a list. (See the Arrays and Lists notes for more details)