2013年10月20日 星期日

第七週課堂作業及回家作業



int area=30;        // Width of the shape
float posx, posy;    // Starting position of shape  
float xspeed = 3;  // Speed of the shape
float yspeed = 2.2;  // Speed of the shape
int xdirection = 1;  // Left or Right
int ydirection = 1;  // Top to Bottom
void setup()
{
  size(1080, 650);
  noStroke();
  frameRate(80);
  ellipseMode(RADIUS);
  posx = width/2;
  posy = height/2;
}
void draw()
{
  background(0);
  posx = posx + ( xspeed * xdirection );
  posy = posy + ( yspeed * ydirection );

   if (posy > height-area || posy < area) {
    ydirection *= -1;
  }
  fill(255);
  rect(mouseX, 625, 150, 25);

  if (posx > width-area || posx < area) {
    xdirection *= -1;
  }



  ellipse(posx, posy, 15, 15);
}


兩個人交一份沒關係, 標注你的學號姓名

1. 請列出你今天三個小時,要完成的事
想完成球可以觸碰到桿子反彈,未觸碰到掉落GAME OVER
2. 你在期中作品要做到什麼程度
想完成一個完整的打磚塊遊戲,上面有方塊可以消掉
3. Why? 你為什麼要做它
覺得這是一個打發時間的一個很好的小遊戲而且玩久了會上癮

沒有留言:

張貼留言