day #3, a cameraNot a whole lot done tonight other than playing for an hour with a camera for some scrolling. I'm a little unsure of a good way to go about it actually, since the x and y properties of pyglet sprites are expressed in window coordinates. When the player presses a key they change the sprite's world coordinates in absolute terms, but to make the camera work then the world coordinates of all the sprites need to be translated to the window coordinates. However, without keeping track of world and window coordinates separately, it seems I need to reverse translate the sprite's x and y at the beginning of the next update back to world coordinates, before applying another transformation to window coordintes. If that makes any sense. It seems like adding a new pair of properties for world xy could be a good choice.
(log in to comment)