GMU:Bots 'n' Plots/Maria Degand

From Medien Wiki

Dokumentation des Kurses

first steps toward my own twitterbot

Der erste Versuch etwas mit Processing und Phyton zu zeichnen



"""
my little robot duck

"""

size(400, 400)
colorMode(RGB, 1) 
background(0, 100, 0)


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)
    
pushMatrix()
translate(350, 0)

#Füß
scale(-1, 1)
triangle(210, 300, 210, 280, 140, 280)
triangle(220, 315, 215, 290, 140, 280)
triangle(225, 320, 220, 300, 140, 280)
popMatrix()

#Schnabel
pushMatrix()
fill(1, 1, 0)
translate(30, 70)
triangle(30, 30, 30, 70, 10, 50)
triangle(30, 50, 30, 70, 10, 50)


translate(20, 50)
rotate(-TWO_PI /8)
rect(-10, 110, 70, 90, 2, 1, 400, 400)
popMatrix()

saveFrame("robot01.png")


Homework: Add Movement to your Robot

nope.

"""
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()

After several hours of looking for a solution on Codecademy and 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".


#Füß
    pushMatrix() 
    def draw():
        mousePressed(fill( 0, 1, 0))
        triangle(140, 300, 140, 310, 190, 310) 
        triangle(150, 305, 150, 305, 195, 310)
    popMatrix() 

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.