Scrolling

I’d wanted the screen to scroll when the character moves to regions not defined on screen, as it’s much nicer to look at, and more natural, than printing a new map. After initially trying to do it in a really stupid way, I settled on using the rect class in Pygame. This contains the physical positions of the sprite in the screen’s co-ordinate system, so it’s then just a matter of adding to or subtracting from the MapObjects’ positions when the character’s rect gets close to the edge of the screen.

However, I’ve found that the MapObjects and the Events move at different rates, meaning they’re no longer in the same location. It just means I’ll have to do something I should’ve done from the start and make them one and the same.

Oh, I also put in a few lines to stop the character annoyingly moving off the edge of the screen. Looks like the movement based drawing is nearly there 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: