2018年9月27日 星期四

Week_04 吳宇凡

1.
size(800,600);
text("Start!",100,100);

2.
fill(255,0,0); rect(100,100,100,100);
  fill(0,0,0);   text("Start!",100,100);

3.
rect(mouseX,mouseY,100,100); text("Start!",mouseX,mouseY);
textSize(80);

4.
 background(255);
  fill(255, 0, 0); 
  rect(100, 100, 100, 100);
  if (bulletFlying) {
    ellipse(bulletX, bulletY, 50, 50);
    bulletX+=3;
  }
}
float bulletX=100, bulletY=100;
boolean bulletFlying=false;
void keyPressed() {
  bulletFlying=true;
}

5.
  for (int i=0; i<bulletN; i++) {
    if  (bulletFlying[i]) {
     ellipse(bulletX[i], bulletY[i], 50, 50);
      bulletX[i]+=3;
    }
  }
float []bulletX=new float[100];
float []bulletY=new float[100];
boolean []bulletFlying= new boolean[100];
int bulletN=0;
void keyPressed() {
  bulletFlying[bulletN]=true;
  bulletX[bulletN]=100; bulletY[bulletN]=100;
  bulletN++;
}

6.
PImage imgBullet;
void setup(){
size(800,600);
imgBullet = loadImage("bullet.png");
}
void draw(){
image(imgBullet,mouseX,mouseY,100,100);
}

7.
PImage imgBullet, imgBG;
void setup() {
  size(800, 600);
  imgBG=loadImage("BG.png");
  imgBullet = loadImage("bullet.png");
  imageMode(CENTER);
}
void draw() {
  image(imgBG, width/2, height/2, width, height);
  image(imgBullet, mouseX, mouseY, 100, 100);
  for (int i=0; i<bulletN; i++) {
    if (bulletFlying[i]) {
      image(imgBullet, bulletX[i], bulletY[i], 100, 100);
    bulletX[i]+=3;
   }
  }
}
float []bulletX=new float[100];
float []bulletY=new float[100];
boolean []bulletFlying= new boolean[100];
int bulletN=0;
void keyPressed() {
  bulletFlying[bulletN]=true;
  bulletX[bulletN]=mouseX;
  bulletY[bulletN]=mouseY;
  bulletN++;
  println(bulletN);
}
8.
bulletY[i]+=bulletVY[i];
    bulletVY[i] +=0.98;
float []bulletVY=new float[100];


沒有留言:

張貼留言