Skip to content

Week 3 04 10

fengttt edited this page Apr 10, 2020 · 1 revision

Plan

  • Draw a text string on on the screen
  • blit
  • Move a shape on the screen.

Homework

  1. Make sure you have the sg.py, and use import sg in your helloworld game. You may have discovered that I put some random code in fengttt/sip. If you have trouble with sg.py and helloworld, you can take a look at my code.
  2. In my example, I moved a circle to the right, then it fall off the screen. Move the circle following a path of square. That is, from starting position, move it right, then down, then left, then up, back to where it starts. Can you move along the path exactly once? Can you keep on moving it along the path?
  3. Print a message at the bottom of the screen, saying how many times you moved your circle along the path.
  4. Create a big square in the middle of the screen, gradually change its color, from RED to BLUE to GREEN then back to RED. You can define your own meaning of gradually but it should look smooth.
  5. Yet another exercise on list.
def reshape(a, n1, n2):
    ''' a is a list of n1*n2 entries.   return a list of n1 lists, each of the n1 lists hold n2 elements.
        For example, a = [1, 2, 3, 4, 5, 6], reshape(a, 2, 3) should return [[1,2,3], [4,5,6]]
    '''
Clone this wiki locally