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

Re: [pygame] Some Platforms



On Saturday 19 February 2005 14:55, Manuel wrote:
<snipppy snip>
>
> This is because it's just a sketch, a kind of 'platform's engine'.
> I get confused with others pyGame scrollers code, so I started this from
> scratch.
> When I get sattisfied with it, I'll add graphics and design levels. In
> other words, fun will start!
>
> I was thinking how to make a scroller from this. I think i need:
> 	a way to move all sprites in function of the player's movement, and
> 	a way to remove sprites from groups when they get out of the screen
>
> This isn't a self-note, I wonder how to do it efficiently.

	I can send you some code/notes if you want. I worked on this and collision 
detection quite a bit until I really got it right (the two are somewhat 
correlated), on my own game. In both situations, I saw my code and logic get 
a bit simpler and cleaner after I had the core functionality well implemented 
and had achieved a better understanding of just what I was doing. I simply 
have some generic Python lists for stuff I want to scroll (my Pygame sprite 
groups are used mostly for precise control over the render order of various 
types of sprites). By using lists, it's a cinch to keep shuffling sprites 
around on the virtual world (and even use them in collision detection for 
off-the-screen bullets etc, if I so choose) while still keeping them out of 
sprite groups.

	-Matt Bailey