2016年10月20日 星期四

Week 06 Sean's note 60408027E


  • HTC Vivi
    • Steam VR 平台 
    • HDMI + USB + DC  +  PC
    • google Tile Brush

  • Processing typgame

import processing.sound.*;
SoundFile soundfile;

void setup() {
  size(600, 400);
  soundfile = new SoundFile(this, "steal.mp3");
  soundfile.play();
}
int shooting=0;
float boxX=200, boxY=0;
int c=0;

char [] boxC = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
  'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
void draw() {
  background(255);
  boxY+=2;
  if (boxY>400) {
    c = int(random(26));
    boxY=0;
  }
  fill(255);
  rect(boxX, boxY, 50, 50);
  fill(255, 0, 0);
  textSize(80);
  text(boxC[c], boxX, boxY);
  if (shooting>0) {
    strokeWeight(40);
    stroke(255, 0, 0);
    line(300, 400, boxX, boxY);
    strokeWeight(1);
    shooting--;
    if (shooting==0) {
      c = int(random(26));
      boxX=random(400)+100;
      boxY=0;
    }
  }
}
void keyPressed() {
  if (key==boxC[c]) {
    shooting=10;
  }
}

沒有留言:

張貼留言