| Line 7: | Line 7: | ||
==My Bots'n'Plots proyects== | ==My Bots'n'Plots proyects== | ||
---- | |||
'''My first animated Python robot''' | '''My first animated Python robot''' | ||
< | |||
[[File:OlisLittlePyRobot.gif]] | |||
Code: | |||
</ | |||
<pre style=""> | |||
""" | |||
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> | |||
---- | |||
==Contributed links== | ==Contributed links== | ||
Revision as of 17:56, 22 April 2015
Wellcome to my participant page! My name is Oliver Hannemann.
Follow me!
My Bots'n'Plots proyects
My first animated Python robot
Code:
"""
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()
Contributed links
Random
Twitter Bots
