期末作品
import processing.sound.*;
SoundFile soundfile;
PImage img,img1,img2,img3,img4,img5,img6,img7,img8,img9,img10,img11,img12,img13,img14,img15,img16,img17;
int state=0,remainT=0,count=1800,count1=3000,count2=0,count3=0,x=200, y=300,win=0;
void setup(){
size(400,600);
soundfile=new SoundFile(this,"panda.mp3");
soundfile.play();
soundfile.loop();
img=loadImage("egg.png");
img1=loadImage("panda1.png");
img2=loadImage("panda2.png");
img3=loadImage("panda3.png");
img4=loadImage("panda4.png");
img5=loadImage("panda5.png");
img6=loadImage("panda6.png");
img7=loadImage("panda7.png");
img8=loadImage("panda8.png");
img9=loadImage("panda9.png");
img10=loadImage("panda10.png");
img11=loadImage("panda11.png");
img12=loadImage("panda12.png");
img13=loadImage("panda13.png");
img14=loadImage("panda14.png");
img15=loadImage("panda15.png");
img16=loadImage("panda16.png");
img17=loadImage("panda17.png");
imageMode(CENTER);
}
void draw(){
count--;
count1--;
if(count==0) {state=1;count1=-1;}
else if(count1==0) {state=3;count=-1;}
else if(count==900) {state=0;}
else if(count1==1500) state=2;
if(win==5) state=10;
if(count2==0)background(255);
else background(#D6D4D4);
//image( img, 0,0);
image( img ,x,y);
if(state==0){//餓了
image( img1 ,x,y);
}
if(state==1){//餓死了
image( img2 ,x,y);
}
if(state==2){//玩
image( img3 ,x,y);
}
if(state==3){//無聊死了
image( img4 ,x,y);
}
if(state==4){//吃
remainT--;
count3++;
if(remainT>60){
image( img5 ,x,y);
}
else{
image( img6 ,x,y);
}
}
if(state==5){//吃死了
remainT--;
if(remainT>60){
image( img7 ,x,y);
}
else{
image( img8 ,x,y);
}
}
if(state==6){//打球
count3++;
remainT--;
if(remainT>60){
image( img9 ,x,y);
}
else{
image( img10 ,x,y);
}
}
if(state==7){//吃球
remainT--;
if(remainT>60){
image( img11 ,x,y);
}
else{
image( img12 ,x,y);
}
}
if(state==8){//洗澡
remainT--;
if(remainT>60){
image( img13 ,x,y);
}
else{
image( img14 ,x,y);
}
}
if(state==9){//喝洗澡水
remainT--;
if(remainT>60){
image( img15 ,x,y);
}
else{
image( img16 ,x,y);
}
}
if(state==10){//贏了
image( img17 ,x,y);
}
}
void mousePressed(){
if(mouseX>=90&&mouseX<=160&&mouseX>=90){
if(mouseY>10*50-25 && mouseY<10*50+50){
if(count3>0){
state=5;
remainT=180;
count=-1;
count1=-1;
}
else if(state!=4&&state!=1&&state!=3&&state!=5&&state!=7){
state=4;
remainT=180;
count=1800;
win++;
}
else if(state==4){
state=5;
remainT=180;
count=-1;
count1=-1;
}
}
}
if(mouseX>=190&&mouseX<=240&&mouseX>=90){
if(mouseY>10*50-25 && mouseY<10*50+50){
if(state==0){
state=7;
remainT=180;
count=-1;
count1=-1;
}
else if(state!=1&&state!=3&&state!=5&&state!=7){
count3++;
state=6;
remainT=180;
count1=3000;
count2++;
}
}
}
if(mouseX>=250&&mouseX<=340&&mouseX>=90){
if(mouseY>10*50-25 && mouseY<10*50+50){
if(state==0){
state=9;
remainT=180;
count=-1;
count1=-1;
}
else if(state!=1&&state!=3&&state!=5&&state!=7){
state=8;
remainT=180;
count2=0;
count3=0;
}
}
}
if(mouseX>0){
if(mouseY>0 && mouseY<400){
if(state==1||state==3||state==5||state==7||state==9){
state=0;
remainT=0;
count=1800;
count1=3000;
count2=0;
count3=0;
x=200;
y=300;
win=0;
}
}
}
}
1.餓--餓死
2.餓--吃球--死
3.餓--喝水--死
1.餓--吃--再吃--吐死(太飽
1.餓--吃--無聊--無聊死
1.餓--吃--無聊--玩--吃--吐死(中毒
1.餓--吃--無聊--玩--洗澡--吃--無聊--玩--洗澡--吃(要餵5次
死了點熊頭重來
沒有留言:
張貼留言