2021年12月20日 星期一

作業中中

 









我做出了可以點滑鼠垂槌子了




程式碼:

PImage img,hammer1,hammer2;

void setup()

{

  size(500,500);

  img = loadImage("ground.jpg");

  imageMode(CENTER);

  hammer1=loadImage("hammer.png");

  hammer2=loadImage("hammer2.png");

  noCursor();

}


void draw(){

  background(255);

  image(img,250,305);

  if(mousePressed)image(hammer2,mouseX,mouseY,250,200);

  else image(hammer1,mouseX,mouseY,190,170);

}

沒有留言:

張貼留言