1. 請寫下以下資料:
1.1. 你之前完成了什麼?
找完素材,想好架構,並尋找可利用的程式
1.2. 你今天計畫要做什麼?
(a)把首頁畫面完成
(b)遊戲畫面裡,酒瓶可以跑出來,準心可以跟著滑鼠移動
1.3. 可能會遇到的問題...
(及可能的解決方法)
(a)選單畫面的設置
(b)儲存酒瓶的陣列
2. 請把你目前期中作品的進度貼出來
(a)首頁畫面
(a)把首頁畫面完成
程式碼:
PImage screenleft,screenright,people,bg;
boolean ctl=true,ctl2=false; //control mouse press
int siteX1=0,siteX2=350,siteX3=525; //Image site
//Var
PImage gun,star;
PImage [] bottle = new PImage[5];
float [] bx = new float [5];
//首頁畫面
void Start()
{
if(mousePressed&&mouseX<430&&mouseX>270&&mouseY<430&&mouseY>270&&ctl)
ctl=false;
if(ctl==false && ctl2==false){
image(screenleft, siteX1-=3, 0, width/2, height);
image(screenright,siteX2+=3,0,width/2, height);
image(people,siteX3+=1,150,width/4, height/1.5);
if(siteX1<-350&&siteX2>700&&siteX3>700) ctl2=true;
if(ctl2) ;
}
else if(ctl==true && ctl2 == false){
image(screenleft, siteX1, 0, width/2, height);
image(screenright,siteX2,0,width/2, height);
image(people,siteX3,150,width/4, height/1.5);
fill(66,66,255);
ellipse(350,350, 80,80);
fill(255,255,0);
textFont(createFont("Georgia", 20));
text("START",320,355);
}
}
void setup() {
//Size
size(700,525);
bg = loadImage("bg.jpg");
//Load Image
screenleft = loadImage("screen_left.jpg");
screenright = loadImage("screen_right.jpg");
people = loadImage("people.png");
//Print Image
image(screenleft, siteX1, 0, width/2, height);
image(screenright,siteX2,0,width/2, height);
image(people,siteX3,150,width/4, height/1.5);
//code
//textFont(createFont("Georgia", 40));
gun=loadImage("gun.png");
star=loadImage("star.png");
for(int i=0;i<5;i++){
bottle[i]=loadImage("bottle.png");
}
}
void draw() {
background(bg);
Start();
//code
if(siteX1<-350&&siteX2>700&&siteX3>700){
bottle();
gun();
}
}
void gun(){
image(gun,530,420);
image(star,mouseX,mouseY);
text("Score:",40,500);
}
void bottle(){
for(int i=0;i<5;i++){
image(bottle[i],i*50+bx[i],98,50,80);
bx[i]+=2;
if(bx[i]==700){
bx[i]=0;
}
}
}
98
回覆刪除