MrThoe

GameState

Sep 21st, 2020
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. var gameExit;
  2.  
  3. function setup() {
  4. createCanvas(400, 400);
  5. gameExit = true;
  6. }
  7.  
  8. function draw() {
  9. startScreen(); //Before entering game
  10. if(!gameExit){
  11. background(0,20,90);
  12. base();
  13. head();
  14. }
  15. }
  16.  
  17. function mouseClicked(){
  18. gameExit = !gameExit;
  19. }
  20.  
  21. function startScreen(){
  22. background(255);
  23. textSize(32);
  24. text("Click Anywhere to Play", 40, 50);
  25. }
  26.  
  27. function base(){
  28. fill(10,200,40);
  29. stroke(100,20,40);
  30. strokeWeight(4);
  31. rect(50, height-height/8, width-100, height/8);
  32. }
  33.  
  34. function head(){
  35. fill(255);
  36. stroke(0);
  37. ellipse(width/2, height/4, 100, 90);
  38. //eyes
  39. fill(0);
  40. ellipse(width/2-15, height/4 -10, 10, 10);
  41. ellipse(width/2+15, height/4-10, 10, 10);
  42. //nose
  43. fill(215, 123, 40);
  44. strokeWeight(1);
  45. triangle(width/2, height/4, width/2-10, height/4+20, width/2-10, height/4+5);
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment