0% found this document useful (0 votes)
132 views

Minecraft Scene Code

The document contains code for drawing various elements of a landscape scene including clouds, trees, grass, and slimes. Functions are defined to draw each individual element, such as drawCloud() to draw clouds with multiple squares, drawTree() to draw tree trunks and leaves, and drawGrass() to draw grass blades and grains. The main drawBackground() function calls all the individual element functions to compose the full digital landscape image.
Copyright
© © All Rights Reserved
0% found this document useful (0 votes)
132 views

Minecraft Scene Code

The document contains code for drawing various elements of a landscape scene including clouds, trees, grass, and slimes. Functions are defined to draw each individual element, such as drawCloud() to draw clouds with multiple squares, drawTree() to draw tree trunks and leaves, and drawGrass() to draw grass blades and grains. The main drawBackground() function calls all the individual element functions to compose the full digital landscape image.
Copyright
© © All Rights Reserved
You are on page 1/ 6

1 // Draws full digital image

2 drawBackground();
3 drawSun();
4 drawCloud(190,70,20);
5 drawCloud(60,200,17);
6 drawTree(350);
7 drawGrass();
8 penUp();
9 moveTo(160, 355);
10 penDown();
11 drawSlime(100);
12 moveTo(170, 255);
13 drawSlime(75);
14 moveTo(180, 178);
15 drawSlime(50);
16
17 //Sun By Nick
18 function drawSun() {
19 penUp();
20 moveTo(230, 100);
21 penDown();
22 penRGB(255, 255, 0, 1);
23 drawSquare(75);
24 }
25
26 //Draws cloud (a lot of white squares put together) By Aiden
27 function drawCloud(botLeftPosX,botLeftPosY,squareSize){
28 penUp();
29 moveTo(botLeftPosX,botLeftPosY);
30 penDown();
31 for (var i = 0; i < 7; i++){
32 drawWhiteSquare(squareSize);
33 }
34 penUp();
35 moveTo(botLeftPosX-squareSize,botLeftPosY-squareSize);
36 penDown();
37 for (var i = 0; i < 9; i++){
38 drawWhiteSquare(squareSize);
39 }
40 penUp();
41 moveTo(botLeftPosX-(squareSize*2),botLeftPosY-(squareSize*2));
42 penDown();
43 for (var i = 0; i < 11; i++){
44 drawWhiteSquare(squareSize);
45 }
46 penUp();
47 moveTo(botLeftPosX-squareSize,botLeftPosY-(squareSize*3));
48 penDown();
49 for (var i = 0; i < 9; i++){
50 drawWhiteSquare(squareSize);
51 }
52 penUp();
53 moveTo(botLeftPosX,botLeftPosY-(squareSize*4));
54 penDown();
55 for (var i = 0; i < 7; i++){
56 drawWhiteSquare(squareSize);
57 }
58 }
59
60 //Draws white square of Unspecified Size By Aiden
61 function drawWhiteSquare(size){
62 penDown();
63 penRGB(255,255,255,1);
64 drawSquare(size);
65 }
66
67 //Draws Square of Unspecified color By Aiden
68 function drawSquare(size) {
69 for (var i = 0; i < size/2; i++) {
70 moveForward(size);
71 turnRight(90);
72 moveForward(1);
73 turnRight(90);
74 moveForward(size);
75 turnLeft(90);
76 moveForward(1);
77 turnLeft(90);
78 }
79 }
80
81 //Draws Background By Aiden
82 function drawBackground(){
83 penDown();
84 penRGB(146,220,231,1);
85 dot(5000);
86 penUp();
87 }
88
89 // Draws Slime by Nick
90 penUp();
91 moveTo(100, 450);
92 penDown();
93 function drawSlimeEverywhere(slimes) {
94 for (var i = 0; i < slimes; i++) {
95 penUp();
96 moveTo(randomNumber(0, 450), randomNumber(0, 450));
97 penDown();
98 drawSlime(randomNumber(5, 100));
99 }
100 }
101
102 //Slime By Nick
103 function drawSlime(size) {
104 //Pen Setup
105 penUp();
106 penRGB(75, 255, 15, 0.6);
107 penWidth(1);
108 //Draw Body
109 penDown();
110 drawSquare(size);
111 penUp();
112 //Draw Eyes
113 penColor("black");
114 moveForward(size - size/4);
115 turnLeft(90);
116 moveForward(size - size/11);
117 turnLeft(90);
118 moveForward(size/4);
119 penDown();
120 turnTo(0);
121 drawSquare(size/3.5);
122 turnRight(90);
123 penUp();
124 moveForward(size/4);
125 turnLeft(90);
126 penDown();
127 drawSquare(size/3.5);
128 //Draw Mouth
129 penUp();
130 turnLeft(90);
131 moveForward(size/3.5);
132 turnLeft(90);
133 moveForward(size/3.5);
134 turnRight(90);
135 moveForward(size/10);
136 turnRight(90);
137 penDown();
138 drawSquare(size/10);
139 penUp();
140 }
141 //Sun By Nick
142 function drawSquare(size) {
143 for (var i = 0; i < size/2; i++) {
144 moveForward(size);
145 turnRight(90);
146 moveForward(1);
147 turnRight(90);
148 moveForward(size);
149 turnLeft(90);
150 moveForward(1);
151 turnLeft(90);
152 }
153 }
154
155 //Draws full tree By Isabella
156 function drawTree(size) {
157 penUp();
158 moveTo(50, size);
159 penDown();
160 drawTreeStump();
161 penUp();
162 moveTo(45, size);
163 penDown();
164 drawTreeStump();
165 penUp();
166 moveTo(5, size);
167 penDown();
168 drawTreeStump();
169 }
170 drawLeaves();
171
172 // Draws tree stump By Isabella
173 function drawTreeStump() {
174 for (var i = 0; i < 2; i++) {
175 penWidth(10);
176 penRGB(117, 85, 30, 1);
177 moveForward(200);
178 turnRight(90);
179 moveForward(20);
180 turnRight(90);
181 moveForward(200);
182 }
183 fillTree();
184 }
185 // fills tree with brown color By Isabella
186 function fillTree() {
187 penRGB(117, 85, 30, 1);
188 moveForward(200);
189 turnRight(90);
190 penWidth(10);
191 moveForward(10);
192 turnRight(90);
193 moveForward(400);
194 }
195 // Draws green leaves by Isabella
196 function drawLeaves() {
197 for (var i = 0; i < 10000; i++) {
198 penUp();
199 moveTo(randomNumber(0, 160), randomNumber(40, 160));
200 penDown();
201 drawFirstLayer();
202 penUp();
203 moveTo(randomNumber(0, 100), randomNumber(10, 180));
204 penDown();
205 drawSecondLayer();
206 }
207 }
208 // Draws first main layer of leaves by Isabella
209 function drawFirstLayer() {
210 penRGB(34, 139, 34, 1);
211 penWidth(10);
212 moveForward(25);
213 penUp();
214 moveForward(10);
215 }
216 // Draws second main layer of leaves by Isabella
217 function drawSecondLayer() {
218 penRGB(34, 139, 34, 1);
219 penWidth(10);
220 moveForward(25);
221 penUp();
222 moveForward(10);
223 }
224
225 //Draws Grass by Emma
226 penUp();
227 moveTo(0, 449);
228 penDown();
229 drawDirt();
230 drawGrass();
231 //draw dirt by Emma
232 function drawDirt() {
233 moveForward(50);
234 turnRight(90);
235 moveForward(320);
236 turnRight(90);
237 moveForward(50);
238 turnRight(90);
239 moveForward(320);
240 turnRight(90);
241 }
242 //draw grass by Emma
243 function drawGrass() {
244 penWidth(30);
245 penRGB(85, 175, 0, 1);
246 moveForward(75);
247 turnRight(90);
248 moveForward(320);
249 turnRight(90);
250 moveForward(60);
251 }
252 turnRight(90);
253 penWidth(110);
254 penRGB(87, 59, 12, 1);
255 moveForward(320);
256 turnRight(90);
257 penUp();
258 moveForward(75);
259 // Draws Grass Blades by Emma
260 function drawGrassBlade(size) {
261 penUp();
262 penDown();
263 penWidth(size);
264 penRGB(85, 107, 47, 1);
265 moveForward(5);
266 moveBackward(5);
267 turnRight(90);
268 moveForward(3);
269 turnLeft(90);
270 }
271 for (var i = 0; i < 107; i++) {
272 drawGrassBlade(randomNumber(1, 2));
273 }
274 // Draws grain in grass by Emma
275 penUp();
276 moveTo(12, 412);
277 function drawDot() {
278 penUp();
279 penWidth(1);
280 penRGB(34, 25, 12, 1);
281 moveTo(randomNumber(1, 500), randomNumber(444, 385));
282 penDown();
283 drawSquare(randomNumber(1,7));
284 penUp();
285 }
286
287 function drawSquare(size) {
288 for (var i = 0; i < size/2; i++) {
289 moveForward(size);
290 turnRight(90);
291 moveForward(1);
292 turnRight(90);
293 moveForward(size);
294 turnLeft(90);
295 moveForward(1);
296 turnLeft(90);
297 }
298 }
299
300 for (var i = 0; i < 400; i++) {
301 drawDot();
302 }
303

PDF document made with CodePrint using Prism

You might also like