[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Sprite group drawing with offset

I'm reading this from my iPhone so I can't verify that this is my
working version, but I can tell that it's missing something important.
I basically changed the sprite.RenderUpdates.draw() to accept a second
and third argument "offsets [x,y]". By default they are set to 0,0
(this is whats missing... Should be def draw(self,screen, offset =
[0,0])) so there would be no argument/type error when older code uses
the draw method without passing the offsets. I felt by letting the
draw method accept an offset, it would be easier to shift a whole
sprite group at once while adding sprite rects to a rectlist.
On 3/10/09, Thiago Chaves <shundread@xxxxxxxxx> wrote:
> Hi,
> I just had a conversation with some people at #pygame on IRC, and it
> seems that at least me and unlucky777 agree that it would be cool to
> be able to pass an offset value to the drawing function on pygame
> sprite groups. The idea is that people who think about a "camera" (or
> when writing games have something more natural to work with).
> Anyway, unlucky777 came up wth some modified renderUpdates sprite
> group to solve a scrolling problem, while I caught myself putting
> offset information on the update method of my sprite classes so I
> could deal with the same problem (but apparently in an uglier way).
> I'm attaching unlycky777's relevant piece of code, and also what I
> came up with. Personally, I like unlucky's idea better.
> Any thoughts?
> -Thiago