Assignment 3

This assignment will be the first start point in designing and writing your own applications ( apps )

It uses the basics of code, variables and the IF command. Once you get to understand how to use these basic code tools – you can write more complex apps.

The challenge is to change the colour of a shape like the Microsoft logo

 

Except that when you have the cursor go into any of the four squares it changes colour.

As a help I have used the IF command here. I have not used variables – but you can use variables for a position as well as a colour

 



// Variables

void setup()
{
  
 // set the size
  size(500,500); 
  
}
void draw()
{
 background(150);
  
  if (mouseX> 250  ) 
  {
    
    if ( mouseY > 250 )
    {
      
      fill(255,0,0);
      rect(250,250,250,250);
   
    }
    
  }
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s