Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41036
| References | <d6374016-8863-4e8b-9ec9-17a826ca2eee@googlegroups.com> <d7296c8c-589f-4955-8643-70dd93ac5dbf@googlegroups.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2013-03-10 13:23 -0600 |
| Subject | Re: Pygame mouse cursor load/unload |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3165.1362943457.2939.python-list@python.org> (permalink) |
On Sat, Mar 9, 2013 at 5:25 PM, Alex Gardner <agardner210@gmail.com> wrote: > On Saturday, March 2, 2013 7:56:31 PM UTC-6, Alex Gardner wrote: >> I am in the process of making a pong game in python using the pygame library. My current problem is that when I move the mouse, it turns off as soon as the mouse stops moving. The way I am doing this is by making the default cursor invisible and using .png files as replacements for the cursor. Perhaps my code would best explain my problem. I will take help in any way that I can. Here are the links that contain my code: >> >> >> >> Main class: http://pastebin.com/HSQzX6h2 >> >> Main file (where the problem lies): http://pastebin.com/67p97RsJ >> >> >> >> If the links yield nothing, please let me know (agardner210@gmail.com) > > I would like to bother you fine folks one last time! There are drawing problems that I am running into. The paddle keeps on moving but it doesn't rewrite the black paddle. This is a problem because the paddle just keeps leaving a green trail. The code is here: http://pastebin.com/gVPPJYWs > > I feel as though I am missing something... You get the streaking because the first blanking operation only ever blanks at (0, 0), and the second one blanks at the new paddle position, not the previous position. You don't need two separate rects to keep track of where the paddle is. blank_rect and b_bounds_rect are entirely unnecessary, so get rid of them. The line "screen.blit(bpaddle, paddle_pos)" should be replaced with "screen.blit(bpaddle, paddle_rect)", because paddle_rect is what you're using to track the paddle location. Since paddle_pos is not being updated, the former would always draw the blank paddle in the upper-left corner. This should also be the only place where you're blanking the paddle, so get rid of the other one. You also don't need the if statement at all. The clamping operation already ensures that the paddle is bounded to the region (0, 0, 300, 300). Once that's gone, you no longer need paddle_pos at all, so you can delete that as well.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-02 17:56 -0800
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-02 20:08 -0700
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-02 19:52 -0800
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-02 19:52 -0800
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-03 14:04 -0800
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-03 14:09 -0800
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-03 16:47 -0700
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-09 16:20 -0800
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-09 16:25 -0800
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-10 13:23 -0600
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-10 15:25 -0700
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-10 19:26 -0600
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-11 09:57 -0700
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-11 10:00 -0700
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-11 10:04 -0700
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-11 11:24 -0600
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-11 10:33 -0700
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-11 12:01 -0600
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-11 13:43 -0700
Re: Pygame mouse cursor load/unload MRAB <python@mrabarnett.plus.com> - 2013-03-11 20:54 +0000
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-11 15:23 -0600
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-12 16:33 -0700
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-12 21:00 -0600
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-14 15:16 -0700
Re: Pygame mouse cursor load/unload Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-14 16:31 -0600
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-14 15:56 -0700
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-18 13:24 -0700
Re: Pygame mouse cursor load/unload Alex Gardner <agardner210@gmail.com> - 2013-03-18 16:05 -0700
csiph-web