Guest User

Untitled

a guest
Oct 22nd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. function setup() {
  2. createCanvas(600,400);
  3. ellipseMode(CENTER);
  4. rectMode(CENTER);
  5. background(140);
  6. }
  7. function keyPressed(){
  8. if (keyCode === LEFT_ARROW) {
  9. background(140);
  10. line(100, 0, 100, 400);
  11. line(0, 100, 600, 100);
  12. line(200, 0, 200, 400);
  13. line(0, 200, 600, 200);
  14. line(300, 0, 300, 400);
  15. line(0, 300, 600, 300);
  16. line(400, 0, 400, 400);
  17. line(500, 0, 500, 400);
  18. line(600, 0, 600, 400);
  19. } else if (keyCode === RIGHT_ARROW) {
  20. background(140);
  21. }
  22. }
  23. function mousePressed(){
  24. print("Xpos is "+mouseX);
  25. print("Ypos is "+mouseY);
  26. }
  27.  
  28. function draw() {
  29. //alien face
  30. fill(63,175,85);
  31. ellipse(200,95,150,150);
  32. //body
  33. rect(200,190,100,200);
  34. triangle(100,200,200,150,300,200);
  35. //ears
  36. ellipse()
  37. //hat
  38. fill(20,65,120);
  39. triangle(100,60,200,10,300,60);
  40. //eye
  41. fill(255,255,255);
  42. ellipse(200,95,60,60);
  43. fill(0,0,0);
  44. ellipse(200,95,20,20);
  45. //mouth fangs
  46. fill(255,255,255);
  47. ellipse();
  48. triangle(170,140,180,150,190,140);
  49. triangle(190,140,200,150,210,140);
  50. triangle(210,140,220,150,230,140);
  51. }
Add Comment
Please, Sign In to add comment