250
edits
MariaDegand (talk | contribs) |
MariaDegand (talk | contribs) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Dokumentation des Kurses == | |||
= | =first steps toward my own twitterbot= | ||
[[Image:Robot01.jpg|200px|thumb|left|Der erste Versuch etwas mit Processing und Phyton zu zeichnen]] | [[Image:Robot01.jpg|200px|thumb|left|Der erste Versuch etwas mit Processing und Phyton zu zeichnen]] | ||
<pre> | |||
<br style="clear:both"> | |||
<pre style="font=2"> | |||
""" | """ | ||
my little robot duck | my little robot duck | ||
Line 49: | Line 52: | ||
saveFrame("robot01.png") | saveFrame("robot01.png") | ||
</pre> | </pre> | ||
== Homework: Add Movement to your Robot == | |||
nope. | |||
<br style="clear:both"> | |||
<pre style="font=2"> | |||
""" | |||
my little robot duck | |||
""" | |||
#Parameters | |||
diameter = 400 | |||
#drawing style | |||
def setup(): | |||
colorMode(RGB, 1) | |||
background(0, 100, 0) | |||
size(diameter, diameter) | |||
def draw(): | |||
#Flügel schlagen lassen wenn Maus über das Bild geht | |||
#Auge | |||
ellipse(100, 120, 90, 90) | |||
ellipse(90, 110, 10, 10) | |||
ellipse(90, 110, 5, 8) | |||
ellipse(90, 110, 3, 3) | |||
#Körper | |||
rect(90, 155, 155, 105, 200, 1, 250, 50) | |||
triangle(120, 120, 120, 100, 90, 100) | |||
#Füß | |||
pushMatrix() | |||
def draw(): | |||
mousePressed(fill( 0, 1, 0)) | |||
triangle(140, 300, 140, 310, 190, 310) | |||
triangle(150, 305, 150, 305, 195, 310) | |||
popMatrix() | |||
#Schnabel | |||
fill(1, 1, 0) | |||
triangle(60, 110, 60, 135, 34, 130) | |||
triangle(60, 110, 60, 125, 34, 130) | |||
#Flügel position | |||
pushMatrix() | |||
translate(50, 120) | |||
rotate(-TWO_PI /8) | |||
rect(-10, 110, 70, 90, 2, 1, 400, 400) | |||
popMatrix() | |||
</pre> | |||
After several hours of looking for a solution on [http://www.codecademy.com/en/tracks/python Codecademy] and [http://py.processing.org Processing] I could not get the wing of the duck-robot to move. I guess I need to get into the "active mode" because everytime I try to add movement ( Orders like: mouseX, courser, sin(), def draw) I get errors like "close breakets in line 3" or "def XY". | |||
<pre> | |||
#Füß | |||
pushMatrix() | |||
def draw(): | |||
mousePressed(fill( 0, 1, 0)) | |||
triangle(140, 300, 140, 310, 190, 310) | |||
triangle(150, 305, 150, 305, 195, 310) | |||
popMatrix() | |||
</pre> | |||
With this I tried to get some reaction from the duck by pressing on the canvas. When pressing on the canvas, the feet should be filled with a different color. Did not work. Feet disappeared. |
edits