// You know, this doesn't take too much effort to obtain. I like drawing straight lines.
// This level is a place for making flower art.
// The real goal is to experiment and have fun!
// If you draw something with at least 1000 flowers, you will "succeed" at the level.
loop {
var x = this.pos.x;
var y = this.pos.y;
var one = Math.floor((Math.random() * 8) + 0.5);
var two = Math.floor((Math.random() / 8) + 0.5);
this.setFlowerColor("red");
this.moveXY(x + one, y - two);
this.moveXY(x - one, y + two);
this.setFlowerColor("yellow");
this.moveXY(x - one, y + one);
this.moveXY(x + one, y + one);
this.setFlowerColor("white");
this.moveXY(x - one, y - two);
this.moveXY(x - two, y - two);
this.moveXY(x + one, y + two);
this.moveXY(x - two, y - two);
this.setFlowerColor("blue");
this.moveXY(x + two, y + two);
this.moveXY(x + one, y + one);
this.moveXY(x - one, y - two);
this.moveXY(x + two, y + two);
this.setFlowerColor("purple");
this.moveXY(x - one, y - one);
this.moveXY(x + one, y - one);
this.moveXY(x + two, y - two);
}
I did this so quickly by the command-c and command-v.
I kind of thought about it. Then…
“Its so easy to obtain this:”
Or that I call the garden of flowers.
And now for the code
loop {
var x = Math.floor((Math.random() * 19) + 8 * 8);
var y = Math.floor((Math.random() * 20) + 8 * 8);
this.setFlowerColor("yellow");
this.moveXY(x, y);
}
See? Its really easy to try and obtain a Garden Of Flowers and you could change the color if you want to,
Yellow:
White:
draw Poly(gon) Stars is a combo function that draws both polygons and stars because the only difference between them is that the stars SKIP vertices of a polygon with the same number of sides. So skips is the number of vertices to skip. (for example: Sides 5 & skip 0 = a pentagon which becomes a pentagram if you skip 1 or 2 vertices. It draws the pentagon “backwards” if you skip 3. And draws nothing (a dot?) if you skip four.)
Here you have a contribution. Basically, takes a text string and writes it to the screen, according to size, color, text spacing and number of columns and rows.
Just 2 functions were used: one for a heart shape and one for a cosine wave. Sorry, they may look pretty hacky.
Functions code
def drawWave(y, x_first, x_last, dense=0.05, amp=10, rtl=False):
X_STEP = 0.5
self.toggleFlowers(False)
def draw(x):
cy = Math.cos(x*dense) * amp
self.moveXY(x, y + cy)
self.toggleFlowers(True)
if rtl:
x = x_last
while x >= x_first:
draw(x)
x -= X_STEP
return
x = x_first
while x <= x_last:
draw(x)
x += X_STEP
def heart(x, y, scale=1):
self.toggleFlowers(False)
PI = Math.PI
def xy(t):
rad_in_deg = PI/180.0
coef = 0.01 * (-t*t + 40*t + 1200)
return (coef * Math.sin(t*rad_in_deg), coef * Math.cos(t*rad_in_deg))
def draw(t, mul=1):
current_x, current_y = xy(t)
current_x *= scale*mul
current_y *= scale
self.moveXY(x + current_x, y + current_y)
self.toggleFlowers(True)
for t in range(61):
draw(t)
self.toggleFlowers(False)
for t in range(60, -1, -1):
draw(t, -1)
The specific function arguments for the picture is a secret of art. The main idea is that just slightly varying parameters of shapes you can get something interesting.