GMU:Bots 'n' Plots/Oliver Hannemann: Difference between revisions

From Medien Wiki
Line 7: Line 7:


==My Bots'n'Plots proyects==
==My Bots'n'Plots proyects==
----




Line 16: Line 13:
[[File:OlisLittlePyRobot.gif]]
[[File:OlisLittlePyRobot.gif]]


Code:
[http://pastebin.com/wHs8j8UC Grab the code at Pastebin]
 
<pre>
 
"""
 
My little Robot
 
"""
 
def setup():
    size(400, 400)
    frameRate(10)
 
 
def draw():
   
    r = random (225)
    background(r, 150 ,r)
   
    pushMatrix()
    translate(0,50)
   
    # 1. Antenne
    pushMatrix()
    translate(200, 100)
    rotate(r/2)
    line(0, 100, 0, 0)
    popMatrix()
 
    # 2. Antenne
    pushMatrix()
    translate(200, 100)
    rotate(-r/2)
    line(0, 0, 0, 100)
    popMatrix()
   
    # Kopf
    ellipse(200, 100, 100, 100)
   
    # L Bein
    pushMatrix()
    translate(175, 145)
    rotate(TWO_PI / 20)
    line(0, 0, 0, 150)
    popMatrix()
   
    # R Bein
    pushMatrix()
    translate(225, 145)
    rotate(-TWO_PI / 20)
    line(0, 0, 0, 150)
    popMatrix()
   
    # L Schuh
    pushMatrix()
    translate(130, 285)
    scale(-1, 1)
    triangle(0, 0, 0, 30, 80, 40)
    fill(255, 204, 0)
    popMatrix()
   
    # R Schuh
    pushMatrix()
    translate(270, 285)
    triangle(0, 0, 0, 30, 80, 40)
    popMatrix()
   
    popMatrix()
 
</pre>