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

Re: [pygame] Display follow



*All* sprites should subtract the camera position when you draw them 
(for example, in their draw() methods)

Then all you have to move is the camera.

---
James Paige

On Mon, Mar 03, 2008 at 10:52:37AM -0500, Samuel Mankins wrote:
> Interesting.
> I'm also going to have to make it so all the other sprites on the screen 
> move in the opposite direction from the player, correct?
> 
> James Paige wrote:
> >I often like to have a "camera" position. Whenever I draw anything, I 
> >subtract the camera position first. Then simply moving the camera 
> >position to follow the player has the effect of making everything else 
> >move the other way.
> >
> >On Sun, Mar 02, 2008 at 06:12:55PM -0500, Samuel Mankins wrote:
> >  
> >>Makes sense... How do I move the world?
> >>
> >>Ian Mallett wrote:
> >>    
> >>>Sure!  You can draw the player in the center of the screen.  Then, to 
> >>>move around, you move the world in the opposite direction, not the 
> >>>player.
> >>>HTH,
> >>>Ian
> >>>      
> >>    
> >
> >
> >  
> 
>