Advertisement
Guest User

Eric help lol

a guest
Nov 20th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. 1) add an ellipse to your program
  2.  
  3. 2) make the ellipse move with your mouse using mouseX , mouseY
  4.  
  5. 3) using "if" try to limit the mouse movement e.g
  6.  
  7. if(mouseX > 200)
  8.  
  9. {
  10.  
  11.  
  12.  
  13. }
  14.  
  15. 4) expirement with color using fill(255,0,0); (change color values)
  16.  
  17. 4) advanced - write a program that tries to imitate a "collision" between two objects. using a state machine.
  18.  
  19. the objects can be two
  20.  
  21. ellipse(100,100,100,100);
  22.  
  23. remember this is a an empty program
  24.  
  25. void setup()
  26.  
  27. {
  28.  
  29. }
  30.  
  31. void draw()
  32.  
  33. {
  34.  
  35. }
  36.  
  37. remember we learnt how to move an ellipse on screen with a variable
  38.  
  39. void setup()
  40.  
  41. {
  42.  
  43. }
  44.  
  45. int xpos = 0;
  46.  
  47. void draw()
  48.  
  49. {
  50.  
  51. xpos = xpos + 1;
  52.  
  53. ellipse(xpos , 100 , 100,100);
  54.  
  55. }
  56.  
  57. and here is an example of an empty state machine
  58.  
  59. int state = 0;
  60.  
  61. void setup()
  62.  
  63. {
  64.  
  65. }
  66.  
  67. int xpos = 0;
  68.  
  69. void draw()
  70.  
  71. {
  72.  
  73. if(state ==0)
  74.  
  75. {
  76.  
  77. }
  78.  
  79. xpos = xpos + 1;
  80.  
  81. ellipse(xpos , 100 , 100,100);
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement