顯示具有 99160556徐煒智 標籤的文章。 顯示所有文章
顯示具有 99160556徐煒智 標籤的文章。 顯示所有文章

2013年1月18日 星期五

Week19, Final


這次的期末作品是拿我們的期中作品來改良的,把原本用滑鼠移動的海綿寶寶改用Arduino的按鍵來坐上下左右的移動

Arduino程式碼:
int buttonPin5 = 5;
int buttonPin2 = 2;
int buttonPin3 = 3;
int buttonPin4 = 4;

int buttonState5 = 0;  
int buttonState2 = 0;  
int buttonState3 = 0;  
int buttonState4 = 0;  
void setup() {

  pinMode(buttonPin5, INPUT);     
  pinMode(buttonPin2, INPUT);     
  pinMode(buttonPin3, INPUT);      
  pinMode(buttonPin4, INPUT);
  
  Serial.begin(9600);

}
void loop() {
  buttonState5 = digitalRead(buttonPin5);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);
  
  if (buttonState5 == HIGH) {     
   //tone(8, 131, 300);
   Serial.write('A');
  }  
  else if (buttonState5 == LOW) { 
   //Serial.write('Z');
  }
  
  if (buttonState2== HIGH) {     
   //tone(8, 147 , 300);
   Serial.print('S');
  }
  else if (buttonState2 == LOW) { 
   //Serial.write('X');
  }

  if (buttonState3 == HIGH) {     
   //tone(8, 165 , 300);
   Serial.print('D');
  }
   else if (buttonState3 == LOW) { 
   //Serial.write('C');
  }

  if (buttonState4 == HIGH) {     
   //tone(8, 175 , 300);
   Serial.print('F');
  }
   else if (buttonState4 == LOW) { 
   //Serial.write('V');
  }
  if(buttonState2 == LOW&&buttonState3 == LOW&&buttonState4 == LOW&&buttonState5 == LOW){
  Serial.write('H');
  }
   delay(500);
}







processing程式碼:


import processing.serial.*;
Serial myPort;

int popox=0,popoy=0,popoy1=0,popoy2=0,popoy3=0,popoy4=0,popoy5=0;
int fishx=0,fishy=0;
int score=600;
int lasttime=60;

import ddf.minim.*;
AudioPlayer  player,wate,cheers;
Minim minim;

PImage popo;
//PImage finger;
PImage bobo;
PImage back;
PImage fish;
void setup()
{
  size(800,600);
  myPort = new Serial(this, "COM3", 9600);
  fish=loadImage("fish.png"); //游動的魚
  bobo=loadImage("bobo.png"); //海綿寶寶
  //finger=loadImage("finger.png"); //手指
  popo=loadImage("popo.png"); //泡泡
  back=loadImage("back.jpeg"); //背景圖
  minim=new Minim(this);
  //wate=minim.loadFile("wate.wav", 2048);
player=minim.loadFile("file.mp3"); //背景音樂
player.play();
}
int val;
int b_x=400,b_y=300;
int w=5,s=5,a=5,d=5;
void draw()
{
  if(myPort.available()>0){
    val = myPort.read();//第三個重點:如果讀到數字就拿出來用
    println(val);
}

  image(back,0,0);
  //image(bobo,250,100);


  popoy-=3; //泡泡移動量
  image(popo,popox+300,popoy+600,100,100);  //泡泡坐標,大小
 
  if (b_x > popox+300 && b_x< popox+400 && b_y<popoy+700 && b_y>popoy+600) //判斷滑鼠是否點到泡泡的範圍
   {
     popoy=600; //泡泡回到下面再跑一次
   score-=10; //碰到泡泡減十分
   wate=minim.loadFile("wate.wav"); //戳到泡泡時播放音效
   wate.play();
   }
 
   if (b_x > popox+200 && b_x< popox+300 && b_y<popoy1+600 && b_y>popoy1+500)
  {
    popoy1=500;
   score-=10;
   wate=minim.loadFile("wate.wav");
   wate.play();
  }
   if (b_x > popox+100 && b_x< popox+200 && b_y<popoy2+800 &&  b_y>popoy2+700)
  {
    popoy2=700;
   score-=10;
   wate=minim.loadFile("wate.wav");
   wate.play();
 }
   if (b_x > popox+500 && b_x< popox+600 && b_y<popoy3+750 && b_y>popoy3+650)
   {
     popoy3=600;
   score-=10;
   wate=minim.loadFile("wate.wav");
   wate.play();
   }
  if (b_x > popox+400 && b_x< popox+500 && b_y<popoy4+950 && b_y>popoy4+850)
  {
    popoy4=600;
  score-=10;
  wate=minim.loadFile("wate.wav");
   wate.play();
  }
    if (b_x > popox+600 && b_x< popox+700 &&  b_y<popoy5+1050 && b_y>popoy5+950)
  {
    popoy5=700;
  score-=10;
  wate=minim.loadFile("wate.wav");
   wate.play();
  }
 
  if(popoy+600<0) //判斷泡泡是否跑出視窗
  {

    popoy=0; //泡泡回到原點再跑一次
  }
   popoy1-=2;
  image(popo,popox+200,popoy1+500,100,100);
   if(popoy1+500<0)
  {

    popoy1=0;
  }
   popoy2-=3;
  image(popo,popox+100,popoy2+700,100,100);
   if(popoy2+700<0)
  {

    popoy2=0;
  }
   popoy3-=5.5;
  image(popo,popox+500,popoy3+650,100,100);
   if(popoy3+650<0)
  {
    popoy3=0;
  }
  popoy4-=2;
  image(popo,popox+400,popoy4+850,100,100);
   if(popoy4+850<0)
  {
    popoy4=0;
  }
  popoy5-=3;
  image(popo,popox+600,popoy5+950,100,100);
   if(popoy5+950<0)
  {
    popoy5=0;
  }

  image(bobo,b_x,b_y,60,60);
  fishx++;
  image(fish,fishx,fishy+200);
  {
    if(fishx>800) //判斷魚是否跑出視窗
    {
    fishx=0;
    fishy=250;
    }
  }
  world();

 if(val=='A'){
    b_x-=4;
  }
 if(val=='S'){
    b_x+=4;
  }
 if(val=='F'){
    b_y-=4;
  }
 if(val=='D'){
    b_y+=4;
  }
  if(val=='H'){
   b_y+=0;
    b_x+=0;
  }
 
  if(b_x<0)
  {
    b_x=0;
  }
 
    if(b_x>745)
  {
    b_x=745;
  }
 
    if(b_y<0)
  {
    b_y=0;
  }

   if(b_y>540)
  {
    b_y=540;
  }
}

  void world()
  {
     textFont(createFont("Georgia", 48));
      fill(255);
  text("score:"+score, 20, 550); //分數
 
  textFont(createFont("Georgia", 48));
      fill(255);
  text("Time:"+lasttime, 250, 550); //計時器
  lasttime=60-millis()/1000;
 
      if(lasttime==0) //當時間=0,秀出得分
      {
      stop();
      textFont(createFont("Georgia", 80));
      background(51,102,51);
      fill(255,255,255);
      text("Game Over",200,300);
      text("Your score:"+score,180,400);
      cheers=minim.loadFile("cheers.wav");
      cheers.play();
      }
  }

心得:
這次的期末作業我們覺得沒有做得很好,Demo到後面的時候有點乾
按鍵道具的部分也是用課堂上的案件,並沒有花心思在其他道具上,但在Arduino的程式上,我們花了不少時間去研究,也學到了不少的東西.

2012年12月6日 星期四

Week13,Hw11

1.程式碼

int inpin1=6;
int inpin2=7;
int inpin3=9;
int inpin4=3;
int inpin5=1;


int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;

void setup() {
 
pinMode(inpin1, INPUT);
pinMode(inpin2, INPUT);
pinMode(inpin3, INPUT);
pinMode(inpin4, INPUT);
pinMode(inpin5, INPUT);


}


void loop() {
  buttonState1 = digitalRead(inpin1);
  buttonState2 = digitalRead(inpin2);
  buttonState3 = digitalRead(inpin3);
  buttonState4 = digitalRead(inpin4);
  buttonState5 = digitalRead(inpin5);

  if (buttonState1 == HIGH)  tone(8, 524,4);
  else if (buttonState2 == HIGH)  tone(8, 588,4);
  else if (buttonState3 == HIGH)  tone(8, 660,4);
  else if (buttonState4 == HIGH)  tone(8, 698,4);
  else if (buttonState5 == HIGH)  tone(8, 784,4);
  else {
  noTone(9);
  }
 
 
 
 
}


2.影片
 

2012年11月27日 星期二

Week12,HW10

1.程式碼


/*
  Analog Input
 Demonstrates analog input by reading an analog sensor on analog pin 0 and
 turning on and off a light emitting diode(LED)  connected to digital pin 13.
 The amount of time the LED will be on and off depends on
 the value obtained by analogRead().

 The circuit:
 * Potentiometer attached to analog input 0
 * center pin of the potentiometer to the analog pin
 * one side pin (either one) to ground
 * the other side pin to +5V
 * LED anode (long leg) attached to digital output 13
 * LED cathode (short leg) attached to ground

 * Note: because most Arduinos have a built-in LED attached
 to pin 13 on the board, the LED is optional.


 Created by David Cuartielles
 modified 30 Aug 2011
 By Tom Igoe

 This example code is in the public domain.

 http://arduino.cc/en/Tutorial/AnalogInput

 */

int sensorPin = A0;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(1, OUTPUT);

}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);  
  // turn the ledPin on
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(10, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(1, HIGH);

  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);        
  // turn the ledPin off:      
  digitalWrite(13, LOW);  
  digitalWrite(12, LOW);
  digitalWrite(10, LOW);
  digitalWrite(7, LOW);
  digitalWrite(3, LOW);
  digitalWrite(6, LOW);
  digitalWrite(1, LOW);
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);                
}

2.影片

2012年11月13日 星期二

Midterm

1 影片


  
2.遊戲方法&截圖
遊戲開始後,下方會開始冒泡泡出來,要用滑鼠去點泡泡,泡泡會消失並且分數會加五分,如果沒有戳到泡泡而讓泡泡跑出視窗,分數會扣五分,為時一分鐘


一分鐘結束後,會秀出所得的分數


3.程式碼

int popox=0,popoy=0,popoy1=0,popoy2=0,popoy3=0,popoy4=0,popoy5=0;
int fishx=0,fishy=0;
int score=0;
int lasttime=60;

import ddf.minim.*;
AudioPlayer  player,wate,cheers;
Minim minim;

PImage popo;
PImage finger;
PImage bobo;
PImage back;
PImage fish;
void setup()
{
  size(800,600);
  fish=loadImage("fish.png"); //游動的魚
  bobo=loadImage("bobo.png"); //海綿寶寶
  finger=loadImage("finger.png"); //手指
  popo=loadImage("popo.png"); //泡泡
  back=loadImage("back.jpeg"); //背景圖
  minim=new Minim(this);
player=minim.loadFile("file.mp3", 2048); //背景音樂
player.play();
}

void draw()
{

  image(back,0,0);
  image(bobo,250,100);


  popoy-=3; //泡泡移動量
  image(popo,popox+300,popoy+600,100,100);  //泡泡坐標,大小
  if(popoy+600<0) //判斷泡泡是否跑出視窗
  { 
    score-=5; //跑出視窗後扣五分
    popoy=0; //泡泡回到原點再跑一次
  }
   popoy1-=2;
  image(popo,popox+200,popoy1+500,100,100);
   if(popoy1+500<0)
  {
    score-=5;
    popoy1=0;
  }
   popoy2-=3;
  image(popo,popox+100,popoy2+700,100,100);
   if(popoy2+700<0)
  {
    score-=5;
    popoy2=0;
  }
   popoy3-=5.5;
  image(popo,popox+500,popoy3+650,100,100);
   if(popoy3+650<0)
  {
    score-=5;
    popoy3=0;
  }
  popoy4-=2;
  image(popo,popox+400,popoy4+850,100,100);
   if(popoy4+850<0)
  {
    score-=5;
    popoy4=0;
  }
  popoy5-=3;
  image(popo,popox+600,popoy5+950,100,100);
   if(popoy5+950<0)
  {
    score-=5;
    popoy5=0;
  }

  image(finger,mouseX-30,mouseY-30,60,60);
  
  fishx++;
  image(fish,fishx,fishy+200);
  {
    if(fishx>800) //判斷魚是否跑出視窗
    {
    fishx=0; 
    fishy=250;
    }
  }
  world();

  
}

void mousePressed()
  {
  
  if (mouseX > popox+300 && mouseX< popox+400 && mouseY<popoy+700 && mouseY>popoy+600) //判斷滑鼠是否點到泡泡的範圍
   {
     popoy=600; //泡泡回到下面再跑一次
   score+=5; //戳到泡泡加五分
   wate=minim.loadFile("wate.wav", 2048); //戳到泡泡時播放音效
   wate.play();
   }
   if (mouseX > popox+200 && mouseX< popox+300 && mouseY<popoy1+600 && mouseY>popoy1+500)
  {
    popoy1=500;
   score+=5;
   wate=minim.loadFile("wate.wav", 2048);
   wate.play();
  }
   if (mouseX > popox+100 && mouseX< popox+200 && mouseY<popoy2+800 && mouseY>popoy2+700)
  {
    popoy2=700;
   score+=5;
   wate=minim.loadFile("wate.wav", 2048);
   wate.play();
 }
   if (mouseX > popox+500 && mouseX< popox+600 && mouseY<popoy3+750 && mouseY>popoy3+650)
   {
     popoy3=600;
   score+=5;
   wate=minim.loadFile("wate.wav", 2048);
   wate.play();
   }
  if (mouseX > popox+400 && mouseX< popox+500 && mouseY<popoy4+950 && mouseY>popoy4+850)
  {
    popoy4=600;
  score+=5;
  wate=minim.loadFile("wate.wav", 2048);
   wate.play();
  }
    if (mouseX > popox+600 && mouseX< popox+700 && mouseY<popoy5+1050 && mouseY>popoy5+950)
  {
    popoy5=700;
  score+=5;
  wate=minim.loadFile("wate.wav", 2048);
   wate.play();
  }
  }
  
  void world()
  {
     textFont(createFont("Georgia", 48)); 
      fill(255);
  text("score:"+score, 50, 550); //分數
  
  textFont(createFont("Georgia", 48));
      fill(255);
  text("Time:"+lasttime, 250, 550); //計時器
  lasttime=60-millis()/1000; 
  
      if(lasttime==0) //當時間=0,秀出得分
      {
      stop();
      textFont(createFont("Georgia", 80));
      background(51,102,51);
      fill(255,255,255);
      text("Game Over",200,300);
      text("Your score:"+score,180,400);
      cheers=minim.loadFile("cheers.wav");
      cheers.play();
      }
  }


   
   

2012年10月30日 星期二

Week08,Hw08

1.1加上手指可以戳泡泡及會游動的魚
1.2加上背景音樂及戳到泡泡時的音效
1.3如何讓泡泡一直不停出現...用回圈寫寫看能不能讓泡泡一直出現

2.1
int popox=0,popoy=0;
int fishx=0,fishy=0;

PImage popo;
PImage finger;
PImage bobo;
PImage back;
PImage fish;
void setup()
{
  size(800,600);
  fish=loadImage("fish.png");
  bobo=loadImage("bobo.png");
  finger=loadImage("finger.png");
  popo=loadImage("popo.png");
  back=loadImage("back.jpeg");
}

void draw()
{
// background(255,255,255);

  
 image(back,0,0);
  image(bobo,250,100);
  popoy-=0.05;
  image(popo,popox+300,popoy+600,100,100);
  popoy-=0.05;
  image(popo,popox+200,popoy+500,100,100);
   popoy-=0.05;
  image(popo,popox+100,popoy+700,100,100);
  popoy-=0.05;
  image(popo,popox+500,popoy+600,100,100);
  
    popoy-=0.05;
  image(popo,popox+300,popoy+1500,100,100);
  popoy-=0.05;
  image(popo,popox+200,popoy+1400,100,100);
   popoy-=0.05;
  image(popo,popox+100,popoy+1300,100,100);
  popoy-=0.05;
  image(popo,popox+500,popoy+1200,100,100);
  
    popoy-=0.05;
  image(popo,popox+300,popoy+1600,100,100);
  popoy-=0.05;
  image(popo,popox+200,popoy+1500,100,100);
   popoy-=0.05;
  image(popo,popox+100,popoy+1700,100,100);
  popoy-=0.05;
  image(popo,popox+500,popoy+1600,100,100);
  
  popoy--;
  image(popo,popox+300,popoy+800,100,100);
  popoy--;
  image(popo,popox+200,popoy+1000,100,100);
   popoy--;
  image(popo,popox+100,popoy+700,100,100);
  popoy--;
  image(popo,popox+500,popoy+1200,100,100);
  
      popoy-=0.05;
  image(popo,popox+300,popoy+2200,100,100);
  popoy-=0.05;
  image(popo,popox+200,popoy+1900,100,100);
   popoy-=0.05;
  image(popo,popox+100,popoy+2000,100,100);
  popoy-=0.05;
  image(popo,popox+500,popoy+1000,100,100);
  
      popoy-=0.05;
  image(popo,popox+400,popoy+2000,100,100);
  popoy-=0.05;
  image(popo,popox+600,popoy+2300,100,100);
   popoy-=0.05;
  image(popo,popox+500,popoy+2400,100,100);
  popoy-=0.05;
  image(popo,popox+500,popoy+2600,100,100);
  
        popoy-=0.05;
  image(popo,popox+100,popoy+2000,100,100);
  popoy-=0.05;
  image(popo,popox+300,popoy+2300,100,100);
   popoy-=0.05;
  image(popo,popox+200,popoy+2400,100,100);
  popoy-=0.05;
  image(popo,popox+100,popoy+2600,100,100);
  
  image(finger,mouseX-30,mouseY-30,60,60);
  
  fishx++;
  image(fish,fishx,fishy+200);
  
}

2.2

2012年10月16日 星期二

Week06,Hw06

1.
   邱垂傑想做的“射擊酒瓶”的遊戲感覺很不錯,射擊的部分跟我戳破泡泡有點像,而且他還有計分&時間的功能
2.
   我們想做的是“海綿寶寶戳泡泡”

   需要
        1.海綿寶寶圖案
        2.泡泡圖案
        3.海底世界背景圖
        4.計時,計分器

  今天有把基本的架構都做出來,泡泡會動了

2012年10月9日 星期二

Week05,Hw05

1.1



void setup(){
    size(600,600);
 
}
   
     float rrr=0.01;
void draw(){
  background(204,255,255);
    fill(153,102,0);
  rect(280,300,20,300);
  translate(300,300);
  rotate(rrr);rrr+=0.02;



  for(int i=0;i<13;i++){
     fill(255,random(255),30+(i+52));
     rotate(PI/6);
     ellipse(100,0,200,40);
  }
    fill(153,51,255);
    ellipse(0,0,100,100);
 
 
}


1.2

2.1花朵會跟著滑鼠一定
void setup(){
    size(600,600);
    
}
     
     float rrr=0.01;
void draw(){
  background(204,255,255);
    fill(153,102,0);
  rect(mouseX,mouseY,20,300);
  translate(mouseX,mouseY);
  rotate(rrr);rrr+=0.02;

  for(int i=0;i<13;i++){
     fill(255,random(255),30+(i+52));
     rotate(PI/6);
     ellipse(100,0,200,40);
  }
    fill(153,51,255);
    ellipse(0,0,100,100); 
    
}
2.2

3.期中想做的作業

海綿寶寶戳泡泡

要盡量戳破更多的泡泡,讓海綿寶寶不要發笑
螢幕邊的計量尺表示海綿寶寶笑的程度,泡泡離越多,笑得越厲害
不要讓計量尺升到頂部




2012年10月2日 星期二

Week04,Hw04


1.1

void setup(){
size(500,400);
}
void draw(){
if(mousePressed) line(mouseX,mouseY,pmouseX,pmouseY);
}


1.2


2.1
void setup()
{
  background(255, 255, 255);
  size(500, 400);
  fill(0,255,51);
  rect(0, 0, 50, 50);
  fill(0, 51, 255);
  rect(0, 50, 50, 50);
  fill(255, 0, 0);
  rect(0, 100, 50, 50);
  fill(255, 255, 0);
  rect(0, 150, 50, 50);
  fill(0, 0, 0);
  rect(0, 200, 50, 50);

  fill(255, 255, 255);
  rect(450, 0, 50, 50);
  rect(450, 50, 50, 50);
  rect(450, 100, 50, 50);

  rect(450, 200, 50, 50);
  rect(450, 250, 50, 50);
  rect(450, 300, 50, 50);
  fill(0,0,0);
  ellipse(475, 25, 5, 5);
  fill(0,0,0);
  ellipse(475, 75, 10, 10);
  fill(0,0,0);
  ellipse(475, 125, 15, 15);
  fill(255,255,255);
  rect(465, 215, 20, 20);
  rect(470, 270, 10, 10);
  fill(255, 0, 0);
  text("SAVE", 465, 330);
}
void draw()
{
  if (mouseX<50&&mouseY>250&&mouseY<300&&mousePressed)
  {
    strokeWeight(0);
  }
  else if (mouseX>450&&mouseX<500&&mouseY>0&&mouseY<50&&mousePressed)
  {
    strokeWeight(0);
  }
  else if (mouseX>450&&mouseX<500&&mouseY>50&&mouseY<100&&mousePressed)
  {
    strokeWeight(10);
  }
  else if (mouseX>450&&mouseX<500&&mouseY>100&&mouseY<150&&mousePressed)
  {
    strokeWeight(20);
  }
  else if (mouseX>450&&mouseX<500&&mouseY>150&&mouseY<200&&mousePressed)
  {
    strokeWeight(30);
  }
  else if (mouseX>450&&mouseX<500&&mouseY>200&&mouseY<250&&mousePressed)
  {
    strokeWeight(40);
    stroke(255, 255, 255);
  }
  else if (mouseX>450&&mouseX<500&&mouseY>250&&mouseY<300&&mousePressed)
  {
    strokeWeight(20);
    stroke(255, 255, 255);
  }
  else if (mouseX>450&&mouseX<500&&mouseY>300&&mouseY<350&&mousePressed)
  {
    saveFrame();
  }
  else if (mouseX<50&&mouseY<50&&mousePressed)
  {
    stroke(0,255,51);
  }
  else if (mouseX<50&&mouseY<100&&mousePressed)
  {
    stroke(0,51,255);
  }
  else if (mouseX<50&&mouseY<150&&mousePressed)
  {
    stroke(255, 0, 0);
  }
  else if (mouseX<50&&mouseY<200&&mousePressed)
  {
    stroke(255, 255, 0);
  }
  else if (mouseX<50&&mouseY<250&&mousePressed)
  {
    stroke(0, 0, 0);
  }
  else if (mousePressed)
  {
    line(mouseX, mouseY, pmouseX, pmouseY);
  }
}

2.2




2012年9月25日 星期二

Week03,Hw03

1.1

void setup()
{
  size(600,600);
}
void draw()
{
  fill(255,0,0); //outside rad
  triangle(20, 265, 150, 30, 280, 265);
  fill(255,255,255); //inside white
  triangle(40, 250, 150, 55, 260, 250);
  fill(0,0,0); //black
  ellipse(150,145,35,110);

  fill(0,0,0); //black
  ellipse(150,227,35,35);

  fill(0,255,0);
  ellipse(mouseX,mouseY,100,100);

}

1.2

2.1速限數字會隨著滑鼠跑
void setup(){
  size(600,600);
  //frameRate(1);
}
float x=100,y=100;
void draw(){
  background(0,138,0);

  fill(255,0,0);
  ellipse(mouseX,mouseY,200,200);
  fill(255,255,255);
  ellipse(mouseX,mouseY,180,180);

  fill(0,0,0);
  ellipse(x-30,y-30,60,60);
  fill(255,255,255);
  ellipse(x-30,y-30,45,45);
  fill(0,0,0);
  ellipse(x-30,y+25,65,65);
  fill(255,255,255);
  ellipse(x-30,y+25,50,50);
  fill(0,0,0);
  ellipse(x+35,y-5,65,110);
  fill(255,255,255);
  ellipse(x+35,y-5,55,90);
  
  //fill(0,0,0);
  //ellipse(x,y-20,30,80);

  x=x*0.9 + mouseX*0.1;
  y=y*0.9 + mouseY*0.1;
}

2.2圖



2012年9月23日 星期日

Week01,HW01

1.1
kinect+processing+Maya


1.2
kitty程式碼


size(800,800);
PImage tiger;
tiger = loadImage("http://www.pices.cn/UploadFiles/Soft7/2010/5/201005050026488665.jpg");
image(tiger,10,10);

1.3



 1.3.2


size(300, 300);  //視窗大小
background(255); //背景

fill(255,0,0); //outside rad
triangle(20, 265, 150, 30, 280, 265);
fill(255,255,255); //inside white
triangle(40, 250, 150, 55, 260, 250);
fill(0,0,0); //black
ellipse(150,145,35,110);

fill(0,0,0); //black
ellipse(150,227,35,35);


1.4
心得:
雖然第一周沒有上到課,但是在家裡練習,到一個程度之後,其實發現也不會太難,
有點類似上學期的Open gl


2012年9月18日 星期二

Week02, HW02

(1)用random畫出50個方格

size(600,600);
for(int i=0;i<50;i++)
{
fill(random(255),random(255),random(255));

rect(random(300),random(600),random(258),random(200));
}

2.pic



3.
size(600,600);
for(int i=0;i<50;i++)
{
  for(int j=0;j<30;j++)
  {
    fill(i*255/30,random(255),200);

      rect(i*20,j*20,20,20);
  }
}

4.pic

5.
size(500,400);
for(int i=0;i<50;i++)
{
  for(int j=0;j<30;j++)
  {
    fill(i*255/30,j*255/10,random(200));
    ellipse(i*20+10,j*20+10,20,20);
    
    fill(i*255/100,j*240/20,100);
    rect(i*20+5,j*20+5,15,15);
  }
}



6.pic

7.心得:

雖然會化兩種形狀,但排列位置上,還是不能依照我想要的去排列,還要再練習