Advertisement
MrsMcLead

Horizon

Oct 30th, 2015
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. int y;
  2. PImage star;
  3. PImage candy;
  4. float scale;
  5.  
  6. void setup()
  7. {
  8.  size(500,500);
  9.  y = height/2;
  10.  background(#000000);
  11.  
  12.  fill(#023F16);
  13.  rect(0,y,width,y);
  14.  
  15.  star = loadImage("star.png");
  16.  candy = loadImage("candy.png");
  17.  scale = 1;
  18.  
  19. }
  20.  
  21. void draw()
  22. {
  23.   //leave blank!!!!!!!!
  24. }
  25.  
  26. void mouseClicked()
  27. {
  28.  
  29.   if(mouseY < y)
  30.   {
  31.   scale =.25* (y / mouseY);
  32.   image(star,mouseX,mouseY,star.width*scale,star.height*scale);
  33.   }
  34.   else
  35.   {
  36.     scale =.25* (y / (height - mouseY));
  37.    image(candy,mouseX,mouseY,candy.width*scale,candy.height*scale);
  38.   }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement