An idea about collisions:
Using masks to check would probably be too slow, so I thought we could do it like this.
Map Wallmasks would be passed at compile time in a special script that checks each pixels and creates a rect there if it is black/opaque/whatever.
This also allows us to scale the maps, which is not easy to do otherwise. Now we just have to scale the surface before drawing.
The string of rects would then be saved and embedded into the .png or even kept as separate file.
It can then be loaded without much problems and without much lag, and suddenly you have rects to collide with instead of masks.
(which, if you only check the rects in the area around the Character, is much faster)
My problem is this:
import os
import glob
import pygame
from load_image import load_image
from pygame.locals import *
surface = pygame.Surface()
path = 'Maps/'
for infile in glob.glob( os.path.join(path, '*_wm.png') ):
image, rect = load_image(infile)
# Loop through all the pixels and create a rect per black pixel
for a in range(0, ???)
There is no built-in function of pygame.Image to determine it's size, so I either have to guess a very large number or get creative.
Ideas?