
Pass "colorkey=theColorYouWant" to the BufferedRenderer constructor. Since per-pixel alpha buffers are used, overall performance will be reduced. When drawing the screen, first blit what you want to be under the map (likeĪ background, or parallax layer), then draw the pyscroll renderer or group. These options will cause the renderer to do more housekeeping,Īctively clearing empty spaces in the buffer, so overall performance will be Yes! There are two ways to handle this situation.both are experimental, but Can I blit anything 'under' the scrolling map layer? Reduced by about 33% Why are there obvious/ugly 'streaks' when scrolling? Since per-pixel alpha buffers are used, overall performance will be You may still have graphical odditiesĭepending on if you clear the screen or not, so you may have to experiment Pass "alpha=True" to the BufferedRenderer constructor.Īll internal buffers will now support 'per-pixel alpha' and the areas without Pyscroll is very fast even with several layers, so there is You canĬreate a simple background layer, and fill with single color tiles where thereĪre gaps. In Tiled (or your data), fill in the empty spots with a tileįor best performance, you must have a tile in each part of the map. There are two ways to fix this issue with the 1st solution being the best When there are empty spaces in all the layers, leaving gaps in the entire map. Several layers, some layers without tiles, and that is fine the problem is This is in consideration of drawing speed. Pyscroll by default will not handle maps that are not completely filled with get_rect(), surfaces) FAQ Why are tiles repeating while scrolling? # tell pyscroll to draw to the screen, and use the surfaces supplied map_layer. # layer numbers higher than this will cover the surface surfaces. this determines which layers the sprite will cover. # the list called 'surfaces' is required for pyscroll # notice the layer. # pyscroll will draw surfaces in screen coordinates, so translate them # you need to use a rect to handle tiles that cover surfaces. here's a made up game engine: def game_engine_draw(): Pyscroll can use a list of surfaces and render them on the map, taking account Give pyscroll surface to layer into the map Try to make itįollow the same API as the TiledMapData adapter and you should be fine. Pyscroll can be used with existing map data, but you will have to create aĬlass to interact with pyscroll or adapt your data handler. draw( screen) Adapting Existing Games / Map Data # Draw map and sprites using the group # Notice I did not `screen.fill` here! Clearing the screen is not # needed since the map will clear it when drawn group. # Add sprite(s) to the group surface = pygame. # make the pygame SpriteGroup with a scrolling map group = pyscroll. # Make the scrolling layer map_layer = pyscroll. # Load TMX data tmx_data = load_pygame( "desert.tmx") """ Simple Sprite class for on-screen things """ def _init_( self, surface): util_pygame import load_pygame import pygame import pyscroll class Sprite( pygame. It's also useful to make minimaps or create simple chunky graphics. The group will work like a camera, translating world coordinates to screenĬoordinates while rendering sprites and map layers.

Sprites can use their rect in world coordinates, and Sprite group that will render all sprites on the map and will correctly draw In order to further simplify using scrolling maps, pyscroll includes a pygame



Pyscroll is compatible with pytmx ( ), so youĬan use your Tiled maps. It doesn't load images or data, so you can use your own custom Uses a lot of magic to get great framerates out of pygame. Pyscroll is a generic module for making a fast scrolling image with pygame. If you find this useful, please consider making a donation to help support it A simple and fast module for animated scrolling maps for your new or existing
