penColor("black");
dot(2000);
penUp();
function drawComet(x, y, size, speed) {
penRGB(238, 71, 29, 1);
moveTo(x, y);
penDown();
dot(size);
penUp();
turnTo(45);
moveForward(size);
turnTo(135);
penDown();
moveForward(speed);
penUp();
moveTo(x, y);
turnTo(180);
moveForward(size);
penDown();
turnTo(135);
moveForward(speed);
penUp();
moveTo(x, y);
turnTo(130);
moveForward(size);
penDown();
moveForward(speed);
penUp();
}
for (var i = 0; i < 4; i++) {
drawComet(randomNumber(10, 300), randomNumber(130, 440), randomNumber(5, 10), randomNumber(20, 40));
}
function drawasteroid(size) {
penRGB(74, 52, 1, 1);
dot(size);
}
function drawasteroidbelt(x, y) {
moveTo(x, y);
drawasteroid(randomNumber(4, 6));
}
for (var i = 0; i < 40; i++) {
drawasteroidbelt(randomNumber(20, 300), randomNumber(100, 20));
}
No comments:
Post a Comment