User Tools

Site Tools


dma:java13:assignment5

Table of Contents

Assignment 5

REVIEW: OR “||” AND “&&”

  • Key Press
  • For Loops

Happy Face Project

  1. I want a floating face that follows my mouse
  2. When you click on the face, I want it to get REALLY happy

Make sure this gets loaded into OpenProcessing with a thumbnail capture!

Make sure your Wordpress is up to par tonight.

Take a look at this Bouncing Cube code:

// Credit: Ren Ervin Bettendorf 

/* SCREENSAVERS FER DAYS BROSKIES */
void setup(){
  size(600,500);  
  background(0);
  frameRate(60);
}

int dx = 2;
int dy = 3;

int x = 50;
int y = 50;

void draw(){
    fill(255);
    rect(x,y,25,25,5);
  
    x = x + dx;
    y = y + dy;
    
    if ( x< 0 || x > 475){
       dx = -1 * dx;
    }
    
    if ( y < 0 || y > 475){
       dy = -1 * dy;  
    }

}
/soe/sherol/.html/teaching/data/pages/dma/java13/assignment5.txt · Last modified: 2013/07/08 15:20 by ffpaladin