2012年10月30日 星期二
week7 HW7
import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
}
最短視訊碼
Week07,Hw07
(1) 期中作品進度
a. 調整俄羅斯方塊介面設計
b. 用鍵盤控制方向 ( ↑、↓、←、→ )
c. 方塊旋轉
◎ 第 7 周進度程式碼
a. 俄羅斯介面設計調整
b. 用鍵盤控制方向 ( ↑、↓、←、→ )
目前遇到的問題
a. 旋轉無法轉到正確位置
b. 方塊如何與格子做對應
(2) 視訊
視訊程式碼
import processing.video.*;
視訊截圖
a. 調整俄羅斯方塊介面設計
b. 用鍵盤控制方向 ( ↑、↓、←、→ )
c. 方塊旋轉
◎ 第 7 周進度程式碼
a. 俄羅斯介面設計調整
PImage cube; float angle=0.01; int mx=300,my=100,rs=300; void setup(){ size(500,500); cube = loadImage("200.png"); // background(255,255,255); for(int i=0;i<12;i++){ //行個數 for(int k=0;k<20;k++){ //列個數 fill(41,205,136,80); rect(i*25,k*25,25,25); } } } void draw(){ //background(255,255,255); translate(mx-18,my-35); rotate(angle); translate(-mx-35,-my-18); scale(1.2); image(cube,mx,my); } void keyPressed(){ if(key==CODED && keyCode==LEFT){ mx-=20; if(mx<0)mx=0; } if(key==CODED && keyCode==RIGHT){ mx+=20; if(mx>445)mx=445; } if(key==CODED && keyCode==DOWN){ my+=20; if(my>460)my=460; } if(key==' '){ angle++; } }
b. 用鍵盤控制方向 ( ↑、↓、←、→ )
PImage cube; float angle=0.01; int mx=300,my=100,rs=300; void setup(){ size(500,500); cube = loadImage("200.png"); background(255,255,255); } void draw(){ background(255,255,255); translate(mx-18,my-35); rotate(angle); translate(-mx-35,-my-18); image(cube,mx,my); } void keyPressed(){ if(key==CODED && keyCode==LEFT){ mx-=20; if(mx<0)mx=0; } if(key==CODED && keyCode==RIGHT){ mx+=20; if(mx&rt;445)mx=445; } if(key==CODED && keyCode==DOWN){ my+=20; if(my&rt;460)my=460; } if(key==' '){ angle++; } }
目前遇到的問題
a. 旋轉無法轉到正確位置
b. 方塊如何與格子做對應
(2) 視訊
視訊程式碼
import processing.video.*;
Capture video; void setup(){ size(640,480,P2D); video = new Capture(this, width, height); video.start(); loadPixels(); } void draw(){ if(video.available()){ video.read(); video.loadPixels(); for(int i=0;i<640*480;i++){ pixels[i]=video.pixels[i]; } updatePixels(); scale(0.5); PImage kitty; kitty = loadImage("132.jpg"); image(kitty, 750,20); scale(0.8); PImage kitty2; kitty2 = loadImage("122.jpg"); image(kitty2, 20,50); } }
視訊截圖
![]() |
| 黃慶華、詹中豪、王靚暄、蕭靖芸 ya |
2012年10月29日 星期一
week7 視訊
//小葉老師最短的視訊
import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
我們可愛的組員及頭上長花反串同學 XD
臉臭臭的組員在認真上課中
2012年10月23日 星期二
week,hw07
boolean a1=false;
boolean s1=false;
boolean d1=false;
boolean f1=false;
boolean z1=false;
boolean x1=false;
boolean c1=false;
boolean v1=false;
boolean y1=false;
boolean u1=false;
boolean i1=false;
boolean o1=false;
boolean h1=false;
boolean j1=false;
boolean k1=false;
boolean l1=false;
int sice=0;
int siceten=0;
void setup(){
size(600,650);
}
void draw()
{
background(255);
fill(255);
/////////////////////////////////////////////第一排
rect(50, 100, 100, 100);
rect(180, 100, 100, 100);
rect(310, 100, 100, 100);
rect(440, 100, 100, 100);
///////////////////////////////////////////////第二排
rect(50, 230, 100, 100);
rect(180, 230, 100, 100);
rect(310, 230, 100, 100);
rect(440, 230, 100, 100);
//////////////////////////////////////////////第三排
rect(50, 360, 100, 100);
rect(180, 360, 100, 100);
rect(310, 360, 100, 100);
rect(440, 360, 100, 100);
//////////////////////////////////////////////第四排
rect(50, 490, 100, 100);
rect(180, 490, 100, 100);
rect(310, 490, 100, 100);
rect(440, 490, 100, 100);
/////////////////////////////////////////////////////////
if(a1)
{
fill(0);
rect(50, 100, 100, 100);
}
if(s1)
{
fill(0);
rect(180, 100, 100, 100);
}
if(d1)
{
fill(0);
rect(310, 100, 100, 100);
}
if(f1)
{
fill(0);
rect(440, 100, 100, 100);
}
/////////////////////////////////////////////////////第一排
if (z1)
{
fill(0);
rect(50, 230, 100, 100);
}
if(x1)
{
fill(0);
rect(180, 230, 100, 100);
}
if(c1)
{
fill(0);
rect(310, 230, 100, 100);
}
if(v1)
{
fill(0);
rect(440, 230, 100, 100);
}
//////////////////////////////////////////第二排
if (y1)
{
fill(0);
rect(50, 360, 100, 100);
}
if(u1)
{
fill(0);
rect(180, 360, 100, 100);
}
if(i1)
{
fill(0);
rect(310, 360, 100, 100);
}
if(o1)
{
fill(0);
rect(440, 360, 100, 100);
}
/////////////////////////////////////////////////////////////第三排
if (h1)
{
fill(0);
rect(50, 490, 100, 100);
}
if(j1)
{
fill(0);
rect(180, 490, 100, 100);
}
if(k1)
{
fill(0);
rect(310, 490, 100, 100);
}
if(l1)
{
fill(0);
rect(440, 490, 100, 100);
}
////////////////////////////////////////////////////////////////第四排////////////X+50.Y+80
if(sice==1)
{
fill(0);
rect(450, 280, 20, 60);
rect(450, 360, 20, 60);
}
if(siceten==1)
{
fill(0);
rect(300, 280, 20, 60);
rect(300, 360, 20, 60);
}
if(sice==2)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(370, 360, 20, 60);
rect(390,420,60,20);
}
if(sice==3)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
}
if(sice==4)
{
fill(0);
rect(370, 280, 20, 60);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
}
if(sice==5)
{
fill(0);
rect(390,260,60,20);
rect(370, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
}
if(sice==6)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
rect(370, 360, 20, 60);
}
if(sice==7)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(450, 360, 20, 60);
}
if(sice==8)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
rect(370, 360, 20, 60);
rect(370, 280, 20, 60);
}
if(sice==9)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
// rect(320, 280, 20, 60);
rect(370, 280, 20, 60);
}
if(sice==0)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
// rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
rect(370, 360, 20, 60);
rect(370, 280, 20, 60);
}
else if(key=='v'|| key == 'V')
{
v1=false;
}
if(key=='y'|| key == 'Y'){
y1=false;
}
else if(key=='u'|| key == 'U'){
u1=false;
}
else if(key=='i'|| key == 'I')
{
i1=false;
}
else if(key=='o'|| key == 'O')
{
o1=false;
}
if(key=='h'|| key == 'H'){
h1=false;
}
else if(key=='j'|| key == 'J'){
j1=false;
}
else if(key=='k'|| key == 'K')
{
k1=false;
}
else if(key=='l'|| key == 'L')
{
l1=false;
}
}
加入計分系統
boolean s1=false;
boolean d1=false;
boolean f1=false;
boolean z1=false;
boolean x1=false;
boolean c1=false;
boolean v1=false;
boolean y1=false;
boolean u1=false;
boolean i1=false;
boolean o1=false;
boolean h1=false;
boolean j1=false;
boolean k1=false;
boolean l1=false;
int sice=0;
int siceten=0;
void setup(){
size(600,650);
}
void draw()
{
background(255);
fill(255);
/////////////////////////////////////////////第一排
rect(50, 100, 100, 100);
rect(180, 100, 100, 100);
rect(310, 100, 100, 100);
rect(440, 100, 100, 100);
///////////////////////////////////////////////第二排
rect(50, 230, 100, 100);
rect(180, 230, 100, 100);
rect(310, 230, 100, 100);
rect(440, 230, 100, 100);
//////////////////////////////////////////////第三排
rect(50, 360, 100, 100);
rect(180, 360, 100, 100);
rect(310, 360, 100, 100);
rect(440, 360, 100, 100);
//////////////////////////////////////////////第四排
rect(50, 490, 100, 100);
rect(180, 490, 100, 100);
rect(310, 490, 100, 100);
rect(440, 490, 100, 100);
/////////////////////////////////////////////////////////
if(a1)
{
fill(0);
rect(50, 100, 100, 100);
}
if(s1)
{
fill(0);
rect(180, 100, 100, 100);
}
if(d1)
{
fill(0);
rect(310, 100, 100, 100);
}
if(f1)
{
fill(0);
rect(440, 100, 100, 100);
}
/////////////////////////////////////////////////////第一排
if (z1)
{
fill(0);
rect(50, 230, 100, 100);
}
if(x1)
{
fill(0);
rect(180, 230, 100, 100);
}
if(c1)
{
fill(0);
rect(310, 230, 100, 100);
}
if(v1)
{
fill(0);
rect(440, 230, 100, 100);
}
//////////////////////////////////////////第二排
if (y1)
{
fill(0);
rect(50, 360, 100, 100);
}
if(u1)
{
fill(0);
rect(180, 360, 100, 100);
}
if(i1)
{
fill(0);
rect(310, 360, 100, 100);
}
if(o1)
{
fill(0);
rect(440, 360, 100, 100);
}
/////////////////////////////////////////////////////////////第三排
if (h1)
{
fill(0);
rect(50, 490, 100, 100);
}
if(j1)
{
fill(0);
rect(180, 490, 100, 100);
}
if(k1)
{
fill(0);
rect(310, 490, 100, 100);
}
if(l1)
{
fill(0);
rect(440, 490, 100, 100);
}
////////////////////////////////////////////////////////////////第四排////////////X+50.Y+80
if(sice==1)
{
fill(0);
rect(450, 280, 20, 60);
rect(450, 360, 20, 60);
}
if(siceten==1)
{
fill(0);
rect(300, 280, 20, 60);
rect(300, 360, 20, 60);
}
if(sice==2)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(370, 360, 20, 60);
rect(390,420,60,20);
}
if(sice==3)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
}
if(sice==4)
{
fill(0);
rect(370, 280, 20, 60);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
}
if(sice==5)
{
fill(0);
rect(390,260,60,20);
rect(370, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
}
if(sice==6)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
rect(370, 360, 20, 60);
}
if(sice==7)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(450, 360, 20, 60);
}
if(sice==8)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
rect(370, 360, 20, 60);
rect(370, 280, 20, 60);
}
if(sice==9)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
// rect(320, 280, 20, 60);
rect(370, 280, 20, 60);
}
if(sice==0)
{
fill(0);
rect(390,260,60,20);
rect(450, 280, 20, 60);
// rect(390,340,60,20);
rect(450, 360, 20, 60);
rect(390,420,60,20);
rect(370, 360, 20, 60);
rect(370, 280, 20, 60);
}
}
void keyPressed(){
if(key=='a'|| key == 'A'){
a1=true;
}
else if(key=='s'|| key == 'S'){
s1=true;
}
else if(key=='d'|| key == 'D')
{
d1=true;
}
else if(key=='f'|| key == 'F')
{
f1=true;
}
if(key=='z'|| key == 'Z'){
z1=true;
}
else if(key=='x'|| key == 'X'){
x1=true;
}
else if(key=='c'|| key == 'C')
{
c1=true;
}
else if(key=='v'|| key == 'V')
{
v1=true;
}
if(key=='y'|| key == 'Y'){
y1=true;
}
else if(key=='u'|| key == 'U'){
u1=true;
}
else if(key=='i'|| key == 'I')
{
i1=true;
}
else if(key=='o'|| key == 'O')
{
o1=true;
}
if(key=='h'|| key == 'H'){
h1=true;
}
else if(key=='j'|| key == 'J'){
j1=true;
}
else if(key=='k'|| key == 'K')
{
k1=true;
}
else if(key=='l'|| key == 'L')
{
l1=true;
}
}
void keyReleased(){
if(key=='a'|| key == 'A')
{
a1=false;
if(sice<10)
{
sice++;
}
if(sice==10)
{
sice=0;
if(siceten<10)
{
siceten++;
}
}
}
if(key=='s'|| key == 'S'){
s1=false;
}
if(key=='d'|| key == 'D')
{
d1=false;
void keyPressed(){
if(key=='a'|| key == 'A'){
a1=true;
}
else if(key=='s'|| key == 'S'){
s1=true;
}
else if(key=='d'|| key == 'D')
{
d1=true;
}
else if(key=='f'|| key == 'F')
{
f1=true;
}
if(key=='z'|| key == 'Z'){
z1=true;
}
else if(key=='x'|| key == 'X'){
x1=true;
}
else if(key=='c'|| key == 'C')
{
c1=true;
}
else if(key=='v'|| key == 'V')
{
v1=true;
}
if(key=='y'|| key == 'Y'){
y1=true;
}
else if(key=='u'|| key == 'U'){
u1=true;
}
else if(key=='i'|| key == 'I')
{
i1=true;
}
else if(key=='o'|| key == 'O')
{
o1=true;
}
if(key=='h'|| key == 'H'){
h1=true;
}
else if(key=='j'|| key == 'J'){
j1=true;
}
else if(key=='k'|| key == 'K')
{
k1=true;
}
else if(key=='l'|| key == 'L')
{
l1=true;
}
}
void keyReleased(){
if(key=='a'|| key == 'A')
{
a1=false;
if(sice<10)
{
sice++;
}
if(sice==10)
{
sice=0;
if(siceten<10)
{
siceten++;
}
}
}
if(key=='s'|| key == 'S'){
s1=false;
}
if(key=='d'|| key == 'D')
{
d1=false;
}
else if(key=='f'|| key == 'F')
{
f1=false;
}
else if(key=='z'|| key == 'Z')
{
z1=false;
}
if(key=='x'|| key == 'X'){
x1=false;
}
if(key=='c'|| key == 'C')
{
c1=false;
}else if(key=='f'|| key == 'F')
{
f1=false;
}
else if(key=='z'|| key == 'Z')
{
z1=false;
}
if(key=='x'|| key == 'X'){
x1=false;
}
if(key=='c'|| key == 'C')
{
c1=false;
else if(key=='v'|| key == 'V')
{
v1=false;
}
if(key=='y'|| key == 'Y'){
y1=false;
}
else if(key=='u'|| key == 'U'){
u1=false;
}
else if(key=='i'|| key == 'I')
{
i1=false;
}
else if(key=='o'|| key == 'O')
{
o1=false;
}
if(key=='h'|| key == 'H'){
h1=false;
}
else if(key=='j'|| key == 'J'){
j1=false;
}
else if(key=='k'|| key == 'K')
{
k1=false;
}
else if(key=='l'|| key == 'L')
{
l1=false;
}
}
加入計分系統
Week07,Hw07
7-1
期中進度:
目前已經有基本架構以及判定案件。
這張是測試用的隨機游標,由於先入先出,以柱列結構儲存。
此圖左邊三行顏色與上圖不同,這是按下案件時的顏色。
今天進度包含了,加速減速,以及判定位置的調節。
(上星期得太嚴苛,玩不下去= =)
之後進度:
1.製作combo的段數,以及該對應圖片。
2.製作分數表,計算方式未定。
3.下列黃色槓槓,更改為更美觀的圖片及特效。
4.背景部分,預計改為動畫。
5.譜面設定。
7-2
此張照片是使用學校所提供的視訊,以及processing內部的預設視訊效果。
期中進度:
目前已經有基本架構以及判定案件。
如圖所示,這是基本架構。
以及測試用的隨機案件,已經能夠判斷是否有在正確位置。
(尚未製作特效,只有案件按下的效果。)
這張是測試用的隨機游標,由於先入先出,以柱列結構儲存。
此圖左邊三行顏色與上圖不同,這是按下案件時的顏色。
今天進度包含了,加速減速,以及判定位置的調節。
(上星期得太嚴苛,玩不下去= =)
之後進度:
1.製作combo的段數,以及該對應圖片。
2.製作分數表,計算方式未定。
3.下列黃色槓槓,更改為更美觀的圖片及特效。
4.背景部分,預計改為動畫。
5.譜面設定。
7-2
此張照片是使用學校所提供的視訊,以及processing內部的預設視訊效果。
這張則是使用背景相減的效果。
這張則是使用ASCII效果。
這張則是基本的視訊影像。
WEEK07, HW07,
專題進度
我們更新的素材
1.素材
2.程式碼
int mx=500,my=500; //預設的預備起跳位子
void setup(){
size(1200,800); //視窗大小
aaa=loadImage("back1.jpg"); //背景圖
ddd=loadImage("ddd.jpg"); //跳跳人
}
void draw(){
image(aaa,0,0);
if(jumpH>0){
jumpH=jumpH-10;
my-=10;
}
if(my<500){
my+=5;
}
image(ddd,mouseX,my,138,235); //讓跳跳人跟著滑鼠X移動
}
jumpH=200 - (500-my); //就跳起
}
我們更新的素材
1.素材
2.程式碼

PImage aaa,ddd; //匯入圖片
int jumpH=0; //跳的高度int mx=500,my=500; //預設的預備起跳位子
size(1200,800); //視窗大小
aaa=loadImage("back1.jpg"); //背景圖
ddd=loadImage("ddd.jpg"); //跳跳人
}
image(aaa,0,0);
if(jumpH>0){
jumpH=jumpH-10;
my-=10;
}
if(my<500){
my+=5;
}
image(ddd,mouseX,my,138,235); //讓跳跳人跟著滑鼠X移動
}
void mouseClicked() //按下滑鼠左鍵
{jumpH=200 - (500-my); //就跳起
}
3. 討論出最後的遊戲
有分難易度
1.普通 速度慢慢地加快
2. 困難 除了速度會慢慢地加快,還會有人垃圾有閃躲
98160860黃麒, 98163021張耀璇, HW07, Week07,
1.視訊
import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
}
2.期中作品:
今天的進度是讓主角阿寶能夠跳躍,跳躍為上樓梯的方式,除此之外
讓背景圖片能夠一直無限延伸。
import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
}
2.期中作品:
今天的進度是讓主角阿寶能夠跳躍,跳躍為上樓梯的方式,除此之外
讓背景圖片能夠一直無限延伸。
Week07,HW07
1.期中作品
int dogx=0,dogy=0;
int dx=1;
PImage dog;
PImage bg;
PImage []num =new PImage[10];
void setup()
{
size(500,500);
dog = loadImage("dog.png");
bg = loadImage("background.png");
image(bg,0,0,500,500);
num[0]=loadImage("0.png");
num[2]=loadImage("1.png");
num[3]=loadImage("2.png");
for(int i=0;j<10;j++){
num[i]=loadImage(""+i+".png");
}
}
void draw(){
//bg = loadImage("background.png");
//background(249,242,226);\
image(bg,0,0,500,500);
if(dogx>400 || dogx<0) dx=-dx;
dogx+=dx;
loadPixels();
for(int Y=dogy;Y>500;Y++)
{
color c=pixels[Y*500+dogx];
if(c==color(255,0,0)){
dogy=Y-100;
break;
}
}
stroke(255,0,0);
line(mouseX,mouseY,pmouseX,pmouseY);
save("background.png");
println("X"+dogx+"Y"+dogy);
//loadPixels();
//stroke(255,0,0);
//line(mouseX,mouseY,pmouseX,pmouseY);
image(dog,dogx,dogy,100,100);
//loadPixels();
}
2.視訊
[圖片]
[程式碼] import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
}
int dogx=0,dogy=0;
int dx=1;
PImage dog;
PImage bg;
PImage []num =new PImage[10];
void setup()
{
size(500,500);
dog = loadImage("dog.png");
bg = loadImage("background.png");
image(bg,0,0,500,500);
num[0]=loadImage("0.png");
num[2]=loadImage("1.png");
num[3]=loadImage("2.png");
for(int i=0;j<10;j++){
num[i]=loadImage(""+i+".png");
}
}
void draw(){
//bg = loadImage("background.png");
//background(249,242,226);\
image(bg,0,0,500,500);
if(dogx>400 || dogx<0) dx=-dx;
dogx+=dx;
loadPixels();
for(int Y=dogy;Y>500;Y++)
{
color c=pixels[Y*500+dogx];
if(c==color(255,0,0)){
dogy=Y-100;
break;
}
}
stroke(255,0,0);
line(mouseX,mouseY,pmouseX,pmouseY);
save("background.png");
println("X"+dogx+"Y"+dogy);
//loadPixels();
//stroke(255,0,0);
//line(mouseX,mouseY,pmouseX,pmouseY);
image(dog,dogx,dogy,100,100);
//loadPixels();
}
2.視訊
[圖片]
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
}
Week07 , HW07
1.期中作品
(a)增加素材
射擊的手槍
瞄準的標靶
2.視訊
執行畫面:
全世界最短視訊程式碼(小葉老師)
import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
}
(a)增加素材
射擊的手槍
瞄準的標靶
2.視訊
執行畫面:
全世界最短視訊程式碼(小葉老師)
import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
}
HW07
int d1=0,d2=0,d3=0,d4=0,d5=0,d6=0,d7=0,d8=0,d9=0;
void setup(){
size(800,600);
PImage mouse;
mouse=loadImage("mouse1.jpg");
image(mouse, 0,0);
}
void draw(){
if(d7==1){
fill(255,0,0);
ellipse(140,125,130,90);
}else{
fill(128,128,128);
}
if(d8==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(390,125,130,90);
if(d9==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(660,125,130,90);
if(d4==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(100,300,130,90);
if(d5==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(390,300,130,90);
if(d6==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(660,290,130,90);
if(d1==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(100,470,130,90);
if(d2==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(395,475,130,90);
if(d3==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(685,490,130,90);
}
void keyPressed(){
if(key=='1'){
d1=1;
}else if(key=='2'){
d2=1;
}else if(key=='3'){
d3=1;
}else if(key=='4'){
d4=1;
}else if(key=='5'){
d5=1;
}else if(key=='6'){
d6=1;
}else if(key=='7'){
d7=1;
}else if(key=='8'){
d8=1;
}else if(key=='9'){
d9=1;
}
}
void keyReleased(){
if(key=='1'){
d1=0;
}else if(key=='2'){
d2=0;
}else if(key=='3'){
d3=0;
}else if(key=='4'){
d4=0;
}else if(key=='5'){
d5=0;
}else if(key=='6'){
d6=0;
}else if(key=='7'){
d7=0;
}else if(key=='8'){
d8=0;
}else if(key=='9'){
d9=0;
}
}
這禮拜我們在課堂上學到按鍵 我們想利用按鍵當感應區 當地鼠出來時可以利用鍵盤打他
問題如何讓地鼠可以隨機出現在洞裡面 還有如何調整速度等等...
.
2.視訊學校做不出來
void setup(){
size(800,600);
PImage mouse;
mouse=loadImage("mouse1.jpg");
image(mouse, 0,0);
}
void draw(){
if(d7==1){
fill(255,0,0);
ellipse(140,125,130,90);
}else{
fill(128,128,128);
}
if(d8==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(390,125,130,90);
if(d9==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(660,125,130,90);
if(d4==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(100,300,130,90);
if(d5==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(390,300,130,90);
if(d6==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(660,290,130,90);
if(d1==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(100,470,130,90);
if(d2==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(395,475,130,90);
if(d3==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
ellipse(685,490,130,90);
}
void keyPressed(){
if(key=='1'){
d1=1;
}else if(key=='2'){
d2=1;
}else if(key=='3'){
d3=1;
}else if(key=='4'){
d4=1;
}else if(key=='5'){
d5=1;
}else if(key=='6'){
d6=1;
}else if(key=='7'){
d7=1;
}else if(key=='8'){
d8=1;
}else if(key=='9'){
d9=1;
}
}
void keyReleased(){
if(key=='1'){
d1=0;
}else if(key=='2'){
d2=0;
}else if(key=='3'){
d3=0;
}else if(key=='4'){
d4=0;
}else if(key=='5'){
d5=0;
}else if(key=='6'){
d6=0;
}else if(key=='7'){
d7=0;
}else if(key=='8'){
d8=0;
}else if(key=='9'){
d9=0;
}
}
這禮拜我們在課堂上學到按鍵 我們想利用按鍵當感應區 當地鼠出來時可以利用鍵盤打他
問題如何讓地鼠可以隨機出現在洞裡面 還有如何調整速度等等...
.
2.視訊學校做不出來
HW07,Week07
今天的進度大概僅限於根據x,y的座標,做出按方格會變色,
已及按a鍵已及滑鼠點擊方格會變另外ㄧ種顏色,
之後可能要讓變色的圖片變成移動的人物,然後按A鍵點擊方塊再丟炸彈
標籤:
98160222賴祺清,
HW07,
Week07
訂閱:
文章 (Atom)


































