1. Post #1
    I still live with my mom // I have a secret furry porn stash // I forgot to wipe my butt this morning
    BloodyDragon's Avatar
    April 2005
    6,735 Posts
    Okay, since people are wanting to know and I GOT A DUMB RATING I'll give you the code I've been working on.

    This is my bike
    Code:
    '''
    Bicycle Assignment
    '''
    __author__ = 'Kurt Hansen'
    __date__ = 'Sept 1, 2009'
    
    
    from cs1graphics import *
    paper = Canvas(500,200, 'white', 'Kurt Hansen')
    
    bike = Layer()
    
    
    '''
    Whole Tire
    '''
    
    tire = Layer()
    tire1 = Circle(40, Point(0,0))
    
    tire1.setBorderWidth(5)
    tire.add(tire1)
    
    spokes = Layer()
    spoke1 = Path(Point(0,0),Point(0,40))
    spoke1.setBorderWidth(2)
    spokes.add(spoke1)
    
    tire.moveTo(110,160)
    tire1.setDepth(30)
    spokes.setDepth(5)
    
    bike.add(tire)
    
    spoke2 = spoke1.clone()
    spoke2.rotate(15)
    spokes.add(spoke2)
    
    spoke3 = spoke2.clone()
    spoke3.rotate(15)
    spokes.add(spoke3)
    
    spoke4 = spoke3.clone()
    spoke4.rotate(15)
    spokes.add(spoke4)
    
    spoke5 = spoke4.clone()
    spoke5.rotate(15)
    spokes.add(spoke5)
    
    spoke6 = spoke5.clone()
    spoke6.rotate(15)
    spokes.add(spoke6)
    
    spokes2 = spokes.clone()
    spokes2.rotate(90)
    tire.add(spokes2)
    
    spokes3 = spokes.clone()
    spokes3.rotate(180)
    tire.add(spokes3)
    
    spokes4 = spokes.clone()
    spokes4.rotate(270)
    tire.add(spokes4)
    
    tire.add(spokes)
    
    
    '''
    Second Tire
    '''
    
    othertire = tire.clone()
    othertire.move(150,0)
    bike.add(othertire)
    
    
    '''
    Frame
    '''
    
    frame = Layer()
    path1 = Path(Point(0,0), Point(60,20))
    path1.setBorderWidth(5)
    path1.setBorderColor('darkRed')
    frame.add(path1)
    
    path2 = Path(Point(60,20), Point(115,-80))
    path2.setBorderWidth(5)
    path2.setBorderColor('darkRed')
    frame.add(path2)
    
    path3 = Path(Point(150,0), Point(115,-80))
    path3.setBorderWidth(5)
    path3.setBorderColor('darkRed')
    frame.add(path3)
    
    path4 = Path(Point(115,-80), Point(30,-70))
    path4.setBorderWidth(5)
    path4.setBorderColor('darkRed')
    frame.add(path4)
    
    path5 = Path(Point(60,20), Point(28,-85))
    path5.setBorderWidth(5)
    path5.setBorderColor('darkRed')
    frame.add(path5)
    
    path6 = Path(Point(30,-70), Point(0,0))
    path6.setBorderWidth(5)
    path6.setBorderColor('darkRed')
    frame.add(path6)
    
    path7 = Path(Point(115,-80), Point(115,-100))
    path7.setBorderWidth(5)
    path7.setBorderColor('darkRed')
    frame.add(path7)
    
    seat = Rectangle(20, 5, Point(28,-85))
    seat.setFillColor('Black')
    frame.add(seat)
    
    seat.setDepth(2)
    
    
    frame.moveTo(110,160)
    
    frame.setDepth(4)
    
    bike.add(frame)
    paper.add(bike)
    This is the environment.

    Code:
    '''
    Environment
    '''
    
    tree = Polygon(Point(50,80), Point(110,100), Point(110,60))
    tree.setFillColor('darkGreen')
    paper.add(tree)
    tree.rotate(90)
    tree.move(300,0)
    tree.setDepth(60)
    
    tree2 = Polygon(Point(0,200), Point(60,60), Point(120,200))
    tree2.setFillColor('darkGreen')
    paper.add(tree2)
    tree2.setDepth(1)
    This is what I've used to do the animation.

    Code:
    '''
    Animation
    '''
    
    paper.wait()
    
    i = 0
    while i<200:
        bike.moveTo(i, 0)
        tire.rotate(-10)
        othertire.rotate(-10)
        i = i+3
    Basically I moved the bike to the right with the moveTo command and also rotated the tire layers WITHIN the bike layer, so that I didn't have to move the tires independently of the bike.

    Anything else whiners?
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 2Informative Informative x 2 (list)

  2. Post #2
    Gold Member
    iPope's Avatar
    October 2008
    1,774 Posts
    What was it? I'm interested now.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Agree Agree x 1 (list)

  3. Post #3
    Gold Member
    nos217's Avatar
    December 2006
    2,665 Posts
    Same haha.

  4. Post #4
    Gold Member
    maurits150's Avatar
    February 2007
    1,810 Posts
    Atleast keep the firstpost and the solution so other people that may have this problem can solve it too.

  5. Post #5
    Gold Member
    Pandamobile's Avatar
    January 2009
    3,703 Posts
    Atleast keep the firstpost and the solution so other people that may have this problem can solve it too.
    Yeah I hate when people do that D:

  6. Post #6
    Gold Member
    Cathbadh's Avatar
    March 2006
    1,071 Posts
    Yeah I hate when people do that D:
    Haven't you heard? The internet exist purely to service one user! If he isn't entertained, the rest of us suffer.

  7. Post #7
    Gold Member
    Pandamobile's Avatar
    January 2009
    3,703 Posts
    :saddowns:

  8. Post #8
    Gold Member
    raccoon12's Avatar
    November 2008
    3,175 Posts
    hi letifer

  9. Post #9
    I still live with my mom // I have a secret furry porn stash // I forgot to wipe my butt this morning
    BloodyDragon's Avatar
    April 2005
    6,735 Posts
    *updated*

  10. Post #10
    Sloped's Avatar
    June 2009
    1,313 Posts
    You could do what I do and just make a timer, which is just an int which you increase every frame. Wait for it to hit your specified value. Then reset the value.