Wednesday 14 March 2012

Interactive systems

For the assignment I decided to create a snowman character. The snowman will consist of thirteen shapes altogether, and there will be a few effects added to these shapes to make it more interesting. To help create my character I created a quick version of what I wanted to create in Microsoft paint. This allowed me to map the points in the picture where each of the shapes would be created.

The first step of my character was to create the snowman’s body. For the body I created three ellipses stacked on top of each other, with the bottom ellipse being the largest and the top being the smallest. The colour of each of part of the body was set to white with a light grey stroke. After creating the body I added the eyes, using the same ellipse function as before with the body.  The colour for the eyes is determined on the position of the mouse, this will allow the eyes to continuously change colour as the mouse is moved.

After adding the eyes the next part of the snowman to be created are the three buttons on the body. Again the “ellipse” function is used to create the circle buttons. Although this time there is two statements in the code for the creation of the buttons, by using the IF ELSE statement I have added the keyPressed function that changes the colour of the buttons. When no keys are pressed the buttons are drawn with a black fill. However when a key is pressed the buttons are drawn each with a different fill colour. This is achieved by giving each ellipse function and different fill value within the code.

The next part of the snowman to be added is the nose. The nose is created using the “triangle” function. The triangle is created using three points which are defined within the code. The triangle also has an orange fill. After creating the snowman’s nose the hat is added. The hat is created using the “rect” function. Like before with the buttons I wanted the hat to change colour, however this time it would change colour when the mouse is clicked. Therefore I used the mousePressed with an IF ELSE statement on the hat so that it was drawn with different fill colours depending on if the mouse is clicked or not.

The final part of the snowman to be created was the arms. They were added using the “line” function. With one end of the line set to a fixed location the other end only had the X axis location set and the Y was determined by the mouse’s position. This allows the arms to move up and down.