• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • about this course
  • syllabus
  • rubric
  • labs
  • blog

HCI | TechX

August 12, 2020

Homework6 Amy

import processing.sound.*;

SoundFile sample;

int u;
int v;
int speedU = 5;
int speedV = 3;
int random;

void setup(){
size(500,500);
u=0;
v=0;
sample = new SoundFile(this, “1.aif”);

}

void draw(){
background(#8B54BC);
//println(AddingNumbers(2,10));
drawFace(u,v,#4F2376,50);
//drawFace(300,100);
//int AddingNumbers(int a ,int b);
//return(a+b);
u=u+speedU;
v=v+speedV;
if(u>width||u<0){ speedU = -speedU; sample.play(); } if(v>height||v<0){
speedV = -speedV;
sample.play();
if (u==width&&v==height){
fill(random(225));
sample.play();
}
}

}

void drawFace(float x,float y, color c, float size){
noStroke();
fill(c);
ellipse(x,y,size,size);

fill(0);
ellipse(x-10,y,10,10);
ellipse(x+10,y,10,10);
}

Filed Under: blog

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Recent Posts

  • Homework Day 8 – Simon Hsieh
  • homework day 8 – Michael
  • Homework-day8-Sophie
  • Harry Hao HW DAY8
  • homework day 8 – dora

Copyright © 2025 HCI | TechX on the Brunch Pro Theme