Assignment 02 – Field of Squares

For assignment 2 I decided to pursue what I think one of my projects will be during this semester. Ever since finding out more about processing and what it can handle, I have really wanted to try and do an old fashioned asteroids game. I figure that if I break it down into smaller components each week I will be able to hopefully get something close to the full game by the end of the semester.

For this assignment I focused on trying to create a field of “asteroids” (I started simple and went with rectangles) that had a random shape, color, and placement in the field of the screen. I wasn’t worried about overlapping or anything like that, I just wanted to be able to create the field randomly with a click. Here are the results with 100-200 random shade of black on the squares with 10,100,1000,10000, and 100000 squares. I placed a slight margin on the page as well.

This slideshow requires JavaScript.

In order to do this I created a class that allowed me to easily change the x and y lengths, x and y placement, as well as color. This is going to allow me to give them movement hopefully soon as well as eventually change their shapes and give them properties like breaking.