This week we converted an images pixels into particles which when we press any key on the keyboard, the image explodes into particles and falls down.

Screen Shot 2014-11-26 at 12.18.02 Screen Shot 2014-11-26 at 12.18.18 Screen Shot 2014-11-26 at 12.18.23

We did this by creating an array list which is a store that will hold all the classes we make if we assign it to the list. By creating a separate class we can call that function multiple times without having to type it all out repeatedly. This is useful for a lot of things like particles. When the particles are added to the ArrayList they are stripped off their interface so we use the class name in parenthesis to reattach the interface to the objects data. When the mouse button is pressed we call update on the particle system to reset the image. To separate the image to pixels and draw each particle to screen by using p.draw.

Screen Shot 2014-11-26 at 12.20.15

Screen Shot 2014-11-26 at 12.23.47Screen Shot 2014-11-26 at 12.23.36Screen Shot 2014-11-26 at 12.24.11Screen Shot 2014-11-26 at 12.24.12

Advertisements