Re: [pygame] Seeing if this works...
Yeah I included a big enough background, and it works now. Thanks. On 10/5/09, Henrique Nakashima henrique.nakash...@gmail.com wrote: When you blit a sprite to the screen, it is not erased from where it was previously blitted. You gotta do it manually, blitting the background over everything then the sprite in its new position. Alternatively, to avoid blitting the whole screen every loop, you can only blit the part of the background which was covered by the sprite in the previous frame, patching it. This technique is called dirty rectangles. Actually, there is a module in pygame - which I never used myself - for doing that: http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.DirtySprite On Tue, Oct 6, 2009 at 00:33, Guy Anderson guy.a.ander...@gmail.com wrote: Well okay :) I'm currently working on a game that will utilize linear movement. I have successfully made it so that the sprite moves around with the arrow keys, but for some reason it leaves sort of a sprite-trail when moving; that is, the sprites from the previous positions don't clear. I've tried utilizing the clear and dirty commands from the pygame module, but I've been unsuccessful. If anyone could help me with this, it would be great. I am attaching the code with the sprite used. On 10/5/09, Luke Paireepinart rabidpoob...@gmail.com wrote: Works fine, Guy.Now on with the questions! :) Also, if your questions are not pygame-specific, please consider subscribing to the Python Tutor mailing list, there's a lot of cool guys over on that list who are happy to help with basic Python questions. On Tue, Oct 6, 2009 at 5:05 AM, Guy Anderson guy.a.ander...@gmail.comwrote: If this is annoying, I don't blame you. It's been years since I've been on a mailing list, though, so I'm trying to see how it all works out. I will have a basic programming question soon, though.
[pygame] Seeing if this works...
If this is annoying, I don't blame you. It's been years since I've been on a mailing list, though, so I'm trying to see how it all works out. I will have a basic programming question soon, though.
Re: [pygame] Seeing if this works...
Well okay :) I'm currently working on a game that will utilize linear movement. I have successfully made it so that the sprite moves around with the arrow keys, but for some reason it leaves sort of a sprite-trail when moving; that is, the sprites from the previous positions don't clear. I've tried utilizing the clear and dirty commands from the pygame module, but I've been unsuccessful. If anyone could help me with this, it would be great. I am attaching the code with the sprite used. On 10/5/09, Luke Paireepinart rabidpoob...@gmail.com wrote: Works fine, Guy.Now on with the questions! :) Also, if your questions are not pygame-specific, please consider subscribing to the Python Tutor mailing list, there's a lot of cool guys over on that list who are happy to help with basic Python questions. On Tue, Oct 6, 2009 at 5:05 AM, Guy Anderson guy.a.ander...@gmail.comwrote: If this is annoying, I don't blame you. It's been years since I've been on a mailing list, though, so I'm trying to see how it all works out. I will have a basic programming question soon, though. Example.rar Description: application/rar-compressed
Re: [pygame] Seeing if this works...
When you blit a sprite to the screen, it is not erased from where it was previously blitted. You gotta do it manually, blitting the background over everything then the sprite in its new position. Alternatively, to avoid blitting the whole screen every loop, you can only blit the part of the background which was covered by the sprite in the previous frame, patching it. This technique is called dirty rectangles. Actually, there is a module in pygame - which I never used myself - for doing that: http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.DirtySprite On Tue, Oct 6, 2009 at 00:33, Guy Anderson guy.a.ander...@gmail.com wrote: Well okay :) I'm currently working on a game that will utilize linear movement. I have successfully made it so that the sprite moves around with the arrow keys, but for some reason it leaves sort of a sprite-trail when moving; that is, the sprites from the previous positions don't clear. I've tried utilizing the clear and dirty commands from the pygame module, but I've been unsuccessful. If anyone could help me with this, it would be great. I am attaching the code with the sprite used. On 10/5/09, Luke Paireepinart rabidpoob...@gmail.com wrote: Works fine, Guy.Now on with the questions! :) Also, if your questions are not pygame-specific, please consider subscribing to the Python Tutor mailing list, there's a lot of cool guys over on that list who are happy to help with basic Python questions. On Tue, Oct 6, 2009 at 5:05 AM, Guy Anderson guy.a.ander...@gmail.comwrote: If this is annoying, I don't blame you. It's been years since I've been on a mailing list, though, so I'm trying to see how it all works out. I will have a basic programming question soon, though.