Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. int [] one = new int[6];
  2. int [] two = new int[6];
  3. int type=1,placeholder=0;
  4. void setup()
  5. {
  6. size(700,600);
  7. for(int i=0;i<6;i++)one[i]=0;
  8. }
  9.  
  10. void draw()
  11. {
  12. background(#FFFFFF);
  13.  
  14. for(int i=0;i<5;i++)
  15. {
  16. if(one[i+1]==0)
  17. {
  18. placeholder=one[i];
  19. one[i]=0;
  20. one[i+1]=placeholder;
  21. }
  22. if(two[i+1]==0)
  23. {
  24. placeholder=two[i];
  25. two[i]=0;
  26. two[i+1]=placeholder;
  27. }
  28. }
  29.  
  30. drawEllipses();
  31. }
  32.  
  33. void mousePressed()
  34. {
  35. if(mouseX>=1 && mouseX<=100 && one[0]==0)
  36. {
  37. one[0]=type;
  38. if(type==1)type=2;
  39. else type=1;
  40. }
  41. if(mouseX>=101 && mouseX<=200 && two[0]==0)
  42. {
  43. two[0]=type;
  44. if(type==1)type=2;
  45. else type=1;
  46. }
  47. }
  48.  
  49.  
  50.  
  51. void drawEllipses()
  52. {
  53. for(int i=1;i<7;i++)
  54. {
  55. if(one[i-1]==0)fill(0);
  56. if(one[i-1]==1)fill(255,0,0);
  57. if(one[i-1]==2)fill(0,0,255);
  58. ellipse(50,i*100-50,50,50);
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement