Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ColorScheme = [randomNumber(127,255),randomNumber(127,255),randomNumber(127,255)];
- penColor ("Black");
- dot (1000);
- //ALIEN ROW DRAWINGS
- // ROWS WILL BE AT y = 70, y = 100, y = 130, y = 160
- penUp ();
- moveTo (16,70);
- penColor ("White");
- dot (20);
- moveTo (16,115);
- dot (20);
- moveTo (16,160);
- dot (20);
- moveTo (16,205);
- dot (20);
- moveTo (16, 250);
- dot (20);
- moveTo (16, 390);
- drawBarriers ();
- //SHIELD CODING BELOW
- function drawBarriers () {
- penUp ();
- moveTo (20, 390);
- for (var B = 0; B < 6; B++){
- drawShieldOutline ((12-B),(15-(B*2)),5);
- turnRight(90);
- moveForward (94 - (8 * B));
- turnRight (90);
- }
- moveTo (200,390);
- for (var B = 0; B < 6; B++){
- drawShieldOutline ((12-B),(15-(B*2)),5);
- turnRight(90);
- moveForward (94 - (8 * B));
- turnRight (90);
- }
- }
- //This code above is a WIP on the compressed version of coding to make a shield
- //This code below is written out form to make shield
- /*
- drawShieldOutline (12,15,5);
- turnRight (90);
- moveForward (94);
- turnRight(90);
- drawShieldOutline (11,13,5);
- turnRight (90);
- moveForward (86);
- turnRight(90);
- drawShieldOutline (10,11,5);
- turnRight (90);
- moveForward (78);
- turnRight(90);
- drawShieldOutline (9,9,5);
- turnRight (90);
- moveForward (70);
- turnRight(90);
- drawShieldOutline (8,7,5);
- turnRight (90);
- moveForward (62);
- turnRight(90);
- drawShieldOutline (7,5,5);
- */
- function drawShieldOutline (Height, Width, Stair) {
- for (var h = 0; h < Height; h++){
- drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], false);
- }
- for (var s = 0; s < Stair; s++){
- drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], false);
- drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], true);
- }
- for (var w = 0; w < Width; w++) {
- drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], true);
- }
- penDown();
- moveForward (2);
- turnRight (90);
- for (var s = 0; s < Stair; s++) {
- drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], true);
- drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], false);
- }
- moveBackward (2);
- turnRight (90);
- moveForward (2);
- for (var h = 0; h < Height; h++){
- drawPixel (ColorScheme[0],ColorScheme[1],ColorScheme[2], false);
- }
- }
- // Draws a 2x2 pixel and moves forward to the origin of the next pixel.
- // A true value for resetToLeft prepares it to draw another pixel to the right.
- // A false value for resetToLeft prepares it to draw another pixel on top.
- function drawPixel(red, green, blue, resetToRight) {
- penWidth(2);
- penRGB(red, green, blue);
- penDown();
- for(var i = 0; i < 3; i++) {
- moveForward(2);
- turnRight(90);
- }
- turnLeft(90);
- penUp();
- if(resetToRight) {
- turnLeft(90);
- moveForward(2);
- turnLeft(90);
- } else {
- turnRight(180);
- moveForward(4);
- turnLeft(90);
- moveForward(2);
- turnRight(90);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement