Pygame mouse cursor load/unload

Ian Kelly ian.g.kelly at gmail.com
Mon Mar 11 14:01:48 EDT 2013


On Mon, Mar 11, 2013 at 11:33 AM, Alex Gardner <agardner210 at gmail.com> wrote:
> My bad!  http://pastebin.com/yuvpT7bH

You're still drawing the blank paddle in two different places.  One of
those places is immediately after you draw the paddle, which undoes
the work you just did in drawing it.  That's why you're not seeing the
paddle.

You're also still not updating the paddle_rect from the current mouse
position, so if you fix the above issue you will find that the paddle
still will not move.  You should restore the "paddle_rect.center =
pygame.mouse.get_pos()" line that you deleted prior to the line that
clamps it.

Finally, you currently have the "clock.tick()" call before the
"pygame.display.update()" call, which makes no sense.  You're doing
your drawing, asking pygame to sleep for 20 milliseconds, and only
then updating the display.  You want to update the display before the
clock.tick() so that the user can actually see the most recent frame
during those 20 milliseconds.



More information about the Python-list mailing list