On Mon, Mar 11, 2013 at 2:43 PM, Alex Gardner <agardner...@gmail.com> wrote: > I tried to append what you told me to. Now it appears that I have a syntax > error! I checked my indentations and they look fine to me, but I get this > error: > > paddle_pos = pygame.mouse.get_pos() > ^ > IndentationError: unindent does not match any outer indentation level
The "for" statement and the statement quoted above should both be at the same indentation level. If you look at the code, the "for" statement is indented 7 spaces whereas the other statement is indented 4 spaces. You need to make them equal. > I added "paddle_rect.center = pygame.mouse.get_pos()" and removed the double > blank paddles. I have no idea if it works though because of the parse error! > New code: http://pastebin.com/maqWCdNB It won't. You've removed both the position-clamping code and the clock tick code entirely. Why did you do that? You've also gone from having two separate lines drawing bpaddle and one line drawing beeper, to having two separate lines drawing beeper, and not drawing bpaddle at all. I think that you need to step back from this and try to understand better the logical flow that you're trying to implement here. Once you understand what it is that you're trying to accomplish, then you can set it down in code. The overall flow should look like this: while True: <check for and handle events> <update the game state> <draw the updated game state> <update the screen> <go to sleep for a while> Try to implement each of those things as a discrete unit, and think hard about what operations need to be done and in what order to accomplish each of those things. It might help you conceptually to split the first three off into separate functions that each do one specific piece of the above, and then implement each of those functions thinking only about what that particular function needs to do. To provide a concrete example of what I am talking about, consider replacing your main loop with this: state = SomeClassRepresentingTheGameState() while True: # checks for a QUIT event process_events(state) # moves the ball and paddles, updates scores, etc. update_game(state) # clears the old state from the display and draws the current state onto it draw_game(state) pygame.display.update() clock.tick(50) And then separately implement all three of those functions, thinking only about how each function needs to interact with the state and what pygame calls it needs to make in order to accomplish its specific task. Right now the state object would only contain your paddle_rect, but later you will presumably have more state to add (e.g. the players' scores, the position and velocity of the ball, etc.), so it will be useful then to have a single object you can pass around to contain those. -- http://mail.python.org/mailman/listinfo/python-list