Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. var ColorScheme = [randomNumber(127,255),randomNumber(127,255),randomNumber(127,255)];
  2. penColor ("Black");
  3. dot (1000);
  4. //ALIEN ROW DRAWINGS
  5. // ROWS WILL BE AT y = 70, y = 100, y = 130, y = 160
  6. penUp ();
  7. moveTo (16,70);
  8. penColor ("White");
  9. dot (20);
  10. moveTo (16,115);
  11. dot (20);
  12. moveTo (16,160);
  13. dot (20);
  14. moveTo (16,205);
  15. dot (20);
  16. moveTo (16, 250);
  17. dot (20);
  18. moveTo (16, 390);
  19. drawBarriers ();
  20.  
  21.  
  22.  
  23. //SHIELD CODING BELOW
  24.  
  25.  
  26.  
  27. function drawBarriers () {
  28. penUp ();
  29. moveTo (20, 390);
  30. for (var B = 0; B < 6; B++){
  31. drawShieldOutline ((12-B),(15-(B*2)),5);
  32. turnRight(90);
  33. moveForward (94 - (8 * B));
  34. turnRight (90);
  35. }
  36. moveTo (200,390);
  37. for (var B = 0; B < 6; B++){
  38. drawShieldOutline ((12-B),(15-(B*2)),5);
  39. turnRight(90);
  40. moveForward (94 - (8 * B));
  41. turnRight (90);
  42. }
  43. }
  44. //This code above is a WIP on the compressed version of coding to make a shield
  45.  
  46. //This code below is written out form to make shield
  47. /*
  48. drawShieldOutline (12,15,5);
  49. turnRight (90);
  50. moveForward (94);
  51. turnRight(90);
  52. drawShieldOutline (11,13,5);
  53. turnRight (90);
  54. moveForward (86);
  55. turnRight(90);
  56. drawShieldOutline (10,11,5);
  57. turnRight (90);
  58. moveForward (78);
  59. turnRight(90);
  60. drawShieldOutline (9,9,5);
  61. turnRight (90);
  62. moveForward (70);
  63. turnRight(90);
  64. drawShieldOutline (8,7,5);
  65. turnRight (90);
  66. moveForward (62);
  67. turnRight(90);
  68. drawShieldOutline (7,5,5);
  69. */
  70.  
  71.  
  72. function drawShieldOutline (Height, Width, Stair) {
  73. for (var h = 0; h < Height; h++){
  74. drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], false);
  75. }
  76. for (var s = 0; s < Stair; s++){
  77. drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], false);
  78. drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], true);
  79. }
  80. for (var w = 0; w < Width; w++) {
  81. drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], true);
  82. }
  83. penDown();
  84. moveForward (2);
  85. turnRight (90);
  86. for (var s = 0; s < Stair; s++) {
  87. drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], true);
  88. drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], false);
  89. }
  90. moveBackward (2);
  91. turnRight (90);
  92. moveForward (2);
  93. for (var h = 0; h < Height; h++){
  94. drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], false);
  95. }
  96. }
  97. // Draws a 2x2 pixel and moves forward to the origin of the next pixel.
  98. // A true value for resetToLeft prepares it to draw another pixel to the right.
  99. // A false value for resetToLeft prepares it to draw another pixel on top.
  100. function drawPixel(red, green, blue, resetToRight) {
  101. penWidth(2);
  102. penRGB(red, green, blue);
  103. penDown();
  104. for(var i = 0; i < 3; i++) {
  105. moveForward(2);
  106. turnRight(90);
  107. }
  108. turnLeft(90);
  109. penUp();
  110. if(resetToRight) {
  111. turnLeft(90);
  112. moveForward(2);
  113. turnLeft(90);
  114. } else {
  115. turnRight(180);
  116. moveForward(4);
  117. turnLeft(90);
  118. moveForward(2);
  119. turnRight(90);
  120. }
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement